The timer is only shown to one player if there are several players in a round. What can I do to give every player in the round a timer?
HandlerTimer(Player : player)<suspends> : void =
if (PlayerUI := GetPlayerUI[Player]):
loop:
Sleep(1.0)
if(finish?):
else:
if(onGround?):
else:
set Seconds += 1
if (Seconds = 60):
set Seconds = 0
set Minutes += 1
if (Minutes = 60):
set Minutes = 0
set Hours += 1
TimerText.SetText(StringToMessage(FormatTime(Hours, Minutes, Seconds)))
FormatTime(Hours1 : int, Minutes1 : int, Seconds1 : int) : string =
HoursStr := if (Hours1 < 10) then "0" + ToString(Hours1) else ToString(Hours1)
MinutesStr := if (Minutes1 < 10) then "0" + ToString(Minutes1) else ToString(Minutes1)
SecondsStr := if (Seconds1 < 10) then "0" + ToString(Seconds1) else ToString(Seconds1)
return HoursStr + ":" + MinutesStr + ":" + SecondsStr
(Player : player).InitUI() : void =
TextWidget : text_block = text_block{DefaultTextColor := NamedColors.White}
ImageWidget : texture_block = texture_block{DefaultImage := MyImage, DefaultDesiredSize := vector2{X := 213.0, Y := 120.0}}
ImageWidget3 : texture_block = texture_block{DefaultImage := MyImage3, DefaultDesiredSize := vector2{X := 426.0, Y := 240.0}}
ImageWidget4 : texture_block = texture_block{DefaultImage := MyImage4, DefaultDesiredSize := vector2{X := 426.0, Y := 240.0}}
ImageWidget2 : texture_block = texture_block{DefaultImage := MyImage2, DefaultDesiredSize := vector2{X := 170.5, Y := 60.0}}
ImageWidget1 : texture_block = texture_block{DefaultImage := MyImage1, DefaultDesiredSize := vector2{X := 511.2, Y := 288.0}}
CombinedCanvas : canvas = canvas:
Slots := array:
canvas_slot:
Widget := ImageWidget
Anchors := anchors{ Minimum := vector2{ X := 0.5, Y := 0.87}, Maximum := vector2{ X := 0.5, Y := 0.97}}
Alignment := vector2{ X := 0.5, Y := 0.345} # Center horizontally, align top vertically
canvas_slot:
Widget := TextWidget
Anchors := anchors{ Minimum := vector2{ X := 0.5, Y := 0.9}, Maximum := vector2{ X := 0.5, Y := 0.8}}
Alignment := vector2{ X := 0.5, Y := 0.0} # Center horizontally, align bottom vertically
canvas_slot:
Widget := ImageWidget1
Anchors := anchors{ Minimum := vector2{ X := 0.5, Y := 0.1}, Maximum := vector2{ X := 0.5, Y := 0.1}}
Alignment := vector2{ X := 0.5, Y := 0.345} # Center horizontally, align top vertically
canvas_slot:
Widget := ImageWidget2
Anchors := anchors{ Minimum := vector2{ X := 0.5, Y := 0.1}, Maximum := vector2{ X := 0.5, Y := 0.1}}
Alignment := vector2{ X := 0.5, Y := 0.010} # Center horizontally, align top vertically
canvas_slot:
Widget := TimerText
Anchors := anchors{ Minimum := vector2{ X := 0.5, Y := 0.107}, Maximum := vector2{ X := 0.5, Y := 0.45}}
Alignment := vector2{ X := 0.5, Y := 0.040} # Center horizontally, align bottom vertically
canvas_slot:
Widget := FailsText
Anchors := anchors{ Minimum := vector2{ X := 0.61, Y := 0.125}, Maximum := vector2{ X := 0.61, Y := 0.125}}
Alignment := vector2{ X := 0.5, Y := 0.5} # Center horizontally and vertically
canvas_slot:
Widget := ImageWidget3
Anchors := anchors{ Minimum := vector2{ X := 0.5, Y := 0.1}, Maximum := vector2{ X := 0.5, Y := 0.1}}
Alignment := vector2{ X := 0.1, Y := 0.385} # Center horizontally, align bottom vertically
canvas_slot:
Widget := ImageWidget4
Anchors := anchors{ Minimum := vector2{ X := 0.29, Y := 0.1}, Maximum := vector2{ X := 0.29, Y := 0.1}}
Alignment := vector2{ X := 0.0, Y := 0.385} # Center horizontally, align bottom vertically
if (PlayerUI := GetPlayerUI[Player], FortCharacter := Player.GetFortCharacter[]):
PlayerUI.AddWidget(CombinedCanvas)
spawn:
FortCharacter.UpdateDistance(Player, TextWidget)
if (PlayerUI := GetPlayerUI[Player]):
PlayerUI.AddWidget(TimerCanvas)
spawn:
HandlerTimer(Player)