Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I make this script repeat every 300 seconds?

This is the script I need help looping!

local time = 31 -- What to countdown
for i = 1, 31 do -- Count 31 - 1
wait(1) -- Wait 1 second to count One number down
time = time - 1
script.Parent.Text = tostring(time) 
end
script.Parent.Text = "Teleporting Players!" -- Changes the text to "Teleporting Players!" When it reaches 0
do
-- This is a code block.
end

Like everyone 300 second this script above this text loops repeats what it suppose does. Thanks to the helpers!

1 answer

✓ Accepted answer

You can use a while loop. Also, if you want to countdown, it's (start at, end at, increment) 31,0,-1 The wait 300 is going to be different for every player though since players join at different times. This (the countdown) is an example of something the server should be in charge of, not the players.

local time = 31 -- What to countdown
local function loop()
	for i = time, 0,-1 do -- Count 31 - 1
		--time = time - 1
		script.Parent.Text = i --tostring(time) 
		wait(1) -- Wait 1 second to count One number down
	end
	script.Parent.Text = "Teleporting Players!" -- Changes the text to "Teleporting Players!" When it reaches 0
	do
	-- This is a code block.
	end
end)

while true do 
-- make the wait(300) before the loop() function if you want to wait 300 first.
	loop()
	wait(300)
end

1 comment

0

Thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.