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

TroubleShoot my Script?

My script contiues to loop, and i do not want it to, i want it to end as soon as the script finishes, but it doesnt, i have tried numerous times to fix it, but it doesnt work, Can you help.

while true do
wait(2)
script.Game.Value = false
wait(5)
for k, p in pairs(game.Players:GetPlayers()) do
    Spawn(function()
        game.Lighting.GameThing:Clone().Parent = p.PlayerGui
        wait(20)
        p.PlayerGui.GameThing:Remove()
        wait()
        p.PlayerGui.Progress:Remove()
        p.PlayerGui.Spectate:Remove()
    end)
end
wait()
local Map = game.Lighting.Map:clone()
Map.Parent = game.Workspace 
Map:makeJoints()
Players = game.Players:GetChildren()
for i = 1, #Players do
    Players[i].Character:MoveTo(Vector3.new(-5.4, 4.39, -64.7))
    script.Game.Value = true
end 
end

1 answer

✓ Accepted answer

Uhm, remove the while loop?

script.Game.Value = false
wait(5)
for k, p in pairs(game.Players:GetPlayers()) do
    Spawn(function()
        game.Lighting.GameThing:Clone().Parent = p.PlayerGui
        wait(20)
        p.PlayerGui.GameThing:Remove()
        wait()
        p.PlayerGui.Progress:Remove()
        p.PlayerGui.Spectate:Remove()
    end)
end
wait()
local Map = game.Lighting.Map:clone()
Map.Parent = game.Workspace 
Map:makeJoints()
Players = game.Players:GetChildren()
for i = 1, #Players do
    Players[i].Character:MoveTo(Vector3.new(-5.4, 4.39, -64.7))
    script.Game.Value = true
end 

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