I am just getting into coding and created this timer script for an obby I made. It works perfectly-- if you only have one person. If you have more than one person it affects everybody. How should I fix this. Looking at videos and stuff i couldn’t find too much but think i need to assign a class with the integers in it. Could you show me what I need to do or at least point me in the right direction thanks!
Here’s the code:
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
Timer_Manager := class(creative_device):
@editable beginning : mutator_zone_device = mutator_zone_device{}
@editable end : mutator_zone_device = mutator_zone_device{}
@editable Screen : hud_message_device = hud_message_device{}
@editable MyPopup : popup_dialog_device = popup_dialog_device{}
@editable EndTele : teleporter_device = teleporter_device{}
var TimeStart : logic = false
var Seconds : int = 00
var Minutes : int = 0
S2M <localizes> (String : string) : message = "{String}"
OnBegin<override>()<suspends>:void=
beginning.AgentEntersEvent.Subscribe(OnStart)
end.AgentEntersEvent.Subscribe(OnFinish)
Screen.SetText(S2M("{Minutes}:0{Seconds}"))
MyPopup.RespondingButtonEvent.Subscribe(OnReset)
EndTele.TeleportedEvent.Subscribe(OnReset1)
OnStart(Agent : agent) : void=
if(TimeStart = true):
else:
set TimeStart = true
spawn {BeginTimer()}
OnReset(Agent : agent, Number : int) : void=
if(Number = 0):
set TimeStart = false
set Minutes = 0
set Seconds = 0
Screen.SetText(S2M("{Minutes}:0{Seconds}"))
else:
OnReset1(Agent : agent) : void=
set TimeStart = false
set Minutes = 0
set Seconds = 0
Screen.SetText(S2M("{Minutes}:0{Seconds}"))
OnFinish(Agent : agent) : void=
set TimeStart = false
BeginTimer() <suspends> : void=
Sleep(1.0)
if(TimeStart = true):
loop:
set Seconds += 1
if(Seconds = 60):
set Seconds =0
set Minutes += 1
if(Seconds < 10):
Screen.SetText(S2M("{Minutes}:0{Seconds}"))
else:
Screen.SetText(S2M("{Minutes}:{Seconds}"))
Sleep(1.0)
if(TimeStart = false):
break

