Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago

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

game:GetService('Players').PlayerAdded:Connect(function(player)
0
hey. idk if your online, but can you reword your question pls Heavenlyblobmaster 271 — 4y
0
? FluffySheep46209 369 — 4y
0
i tried to answer your question Heavenlyblobmaster 271 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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
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 FluffySheep46209 369 — 4y
0
...? Heavenlyblobmaster 271 — 4y
0
you want start a script, and then have it continue when a player is added? Heavenlyblobmaster 271 — 4y
0
I want to have a player variable but so it's not player added so the script runs forever FluffySheep46209 369 — 4y
0
you just want a script to loop forever? Heavenlyblobmaster 271 — 4y
Ad

Answer this question