Hey scriptinghelpers, I'm working on a minigame sort of game and I'm wondering how I would end the "round" when a player touches a certain part (that part is named TP). Below I will provide a piece of my script not the whole thing because, it's long and you won't need all of it this will just be the game part and I can provide more if needed. I'm trying to make it end the round when the part is touched. I would like to make it have like 10 seconds after the part is touched for the time left on the round.
Honestly this is confusing me I'm not really sure how I would do this but this is what I tried.
Edit: I used a break to fix this. The solution is below with some information just incase. This is the link I found helpful: https://developer.roblox.com/en-us/articles/Loops#breaking-loops
This is a (part of) script in ServerScriptStorage.
local function playGame()
local timeamount = 60
local timetext = "Time: "
while timeamount > 0 do
remoteevent:FireAllClients(timeamount, timetext)
wait(1)
timeamount -= 1
if game.Workspace.TP.BoolValue.Value == true then
break
end
end
if game.Workspace.TP.BoolValue.Value == true then
local timeamount = 10
local timetext = game.Workspace.TP.NumberOne.Value.." "
while timeamount > 0 do
remoteevent:FireAllClients(timeamount, timetext)
wait(1)
timeamount -= 1
end
else
end
end
Thanks for the help in advance. I'm only here to learn!

2 comments
Hello, I am confused, why is there an elseif if there is no if statement?
I edited the question to an updated version of this. I didn't think about that but, I'm still having problems.