local s = script.Stat local vals = game.ReplicatedStorage.vals t = 0 while true do local plrs = game.Players:GetChildren() if #plrs > 0 then t = 15 repeat t = t-1 s.Value = "Intermission.. "..t wait(1) until t == 0 s.Value = "Get Ready to Wipeout!" wait(2) local mapselect = game.ReplicatedStorage.Games:GetChildren() local choose = math.random(1,#mapselect) curnum = 0 for i =1,#mapselect do curnum = curnum +1 if curnum == choose then mapselect[i]:Clone().Parent = workspace curmap = mapselect[i].Name s.Value = "The next course is "..mapselect[i].Name end end wait(3) local plrs = game.Players:GetChildren() for i = 1,#plrs do local num = math.random(1,10) plrs[i].Character.Head.CFrame = CFrame.new(workspace.Teleports["Part"..num].Position) plrs[i].Character.Parent = workspace.Ingame end t = 0 repeat t = t+1 s.Value = t.. wait(1) until t ==300 or vals.Winner.Value ~= "" or #ingame == 0 if vals.Winner.Value ~= "" then s.Value = vals.Winner.Value.. " has won!" game.Players[vals.Winner.Value].leaderstats.Points.Value =game.Players[vals.Winner.Value].leaderstats.Points.Value +50 game.Players[vals.Winner.Value].leaderstats.Wins.Value = game.Players[vals.Winner.Value].leaderstats.Wins.Value +1 vals.Winner.Value = "" else s.Value = "No one has won!" end wait(3) local ingame = workspace.Ingame:GetChildren() for i =1,#ingame do local plr = game.Players:GetPlayerFromCharacter(ingame[i]) plr:LoadCharacter() end workspace[curmap]:Destroy() else s.Value = "Waiting for Players..." wait(1) end end
Okay, so I looked up coding tutorials and I tried coding a minigame place. However when it gets to this part, it always freezes the timer and the code stops. I don't really understand why though.
repeat t = t+1 s.Value = t.. wait(1)
you cant put 2 dots after a value since 2 dots means followed by, it puts in the value for t but then it wants more due to those dots so if you want to have 2 dots in your value then you need to do the following s.Value == t..".."
I would use a while
loop for this occasion. I developed a similar place, in which players would participate in various minigames, with a timer counting down each one. I used a while
loop for that. Here's your code, for the timer, with a while loop instead.
local plrs = game.Players:GetChildren() if #plrs > 0 then t = 15 while t ~= -1 do t = t-1 s.Value = "Intermission.. "..t wait(1) end
Try that, and I hope it helps!