While true do Script | Any improvment?

Hey everyone,

I just need a quick code review for my while true do script and If there is anything I can improve

while true do
	wait(3)
	GameProgressValue.Value = "Starting.."
	wait(5)
	GameProgressValue.Value = "Teleporting.."
	Teleport()
	wait(2)
	GameProgressValue.Value = "Choosing Roles"
	giveRoles()
	wait(5)
	GameProgressValue.Value = "In Progress"
	wait(2)
	-- start timer
	for i, plr in pairs(game.Players:GetPlayers()) do if plr:FindFirstChild("GameRole").Value ~= "" then game.ReplicatedStorage.Timer:FireClient(plr,25,false) end end
	wait(24)
	PartsDone()
	wait(2)
	GameProgressValue.Value = "Game Ended"
	TeleportBack()
end

Thanks for reading.

YEs you can use for loops lol :grinning_face_with_smiling_eyes:

2 Likes

Oh and becarfull when sending a number through a remote event it can make hackers change the value of the timer

1 Like

hmm… It’s only a timer and I know about it

the only thing It does It’s to start a countdown on the client

but Thanks for pointing this :+1:

But they can make it -500 or lower and the game would last forever

2 Likes

hmm… no I said It only display the number and not trust the client, the server doesn’t wait for each client

after 24 seconds It’s will just keep going :+1:

First of all please write “choosing” insted of “choseing”
Other than that It’s good. if you’re a beginner

2 Likes

Oh Thanks I didn’t saw It

I was focused on the functions, that I forgot to check spelling mistakes

I don’t think I’m a beginner…

1 Like