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

How do can I substitute PlayerAdded so that the script loops?

Can you change this to save player but not using player added

game:GetService('Players').PlayerAdded:Connect(function(player)

3 comments

0

hey. idk if your online, but can you reword your question pls

0

?

0

i tried to answer your question

1 answer

✓ Accepted answer

It think this is what you mean. if you want a script to loop when a player is added, just do this:

game:GetService('Players').PlayerAdded:Connect(function(player)
	while true do
		-- the script you want to be looped in here
		wait(num) -- Replace "num" with the amount of time in-between each loop
	end
end

EDIT Try this script

function OnNewPlayer()
	--put what you want to happen to the game AFTER the player are added here
end

--put what you want to happen before the player is added here

game:GetService('Players').PlayerAdded:Connect(OnNewPlayer)  

EDIT #2 If you just want a script to loop forever, try this here:

while true do
	-- put script here
	wait(num) -- Replace "num" with the amount of time in-between each loop
end

5 comments

0

Would you be able to adjust it where the script loops but not when the player is added, so the script carries on when the player is added

0

...?

0

you want start a script, and then have it continue when a player is added?

0

I want to have a player variable but so it's not player added so the script runs forever

0

you just want a script to loop forever?

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