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

Question about infinite looping.. studio crashing?

Asked by 7 years ago

If I add a wait to this script, it doesn't work. Am I not putting it in the right place? I was thinking about adding a while wait but I don't know where to place it, can somebody help me out because right now it crashes my studio every time I run it because of the "end)" it's infinitely looping without a wait

game.Players.PlayerAdded:connect(function(player)
    local PLAYERFILE = Instance.new("IntValue")
    PLAYERFILE.Name = player.Name
    local PLAYN = player.Name
    PLAYERFILE.Parent = game.ServerScriptService.PlayerFiles
    wait(1)
    do
    game:GetService("InsertService"):LoadAsset(747089665).Parent = game.ServerScriptService.PlayerFiles:FindFirstChild(player.Name)
    end
end)
0
It would be much better to only insert the object once and simply clone it afterwards. 1waffle1 2908 — 7y

1 answer

Log in to vote
0
Answered by
o_Blyzo 12
7 years ago

I'd try putting the wait here instead :

game.Players.PlayerAdded:connect(function(player)
    local PLAYERFILE = Instance.new("IntValue")
    PLAYERFILE.Name = player.Name
    local PLAYN = player.Name
    PLAYERFILE.Parent = game.ServerScriptService.PlayerFiles
    do
    game:GetService("InsertService"):LoadAsset(747089665).Parent = game.ServerScriptService.PlayerFiles:FindFirstChild(player.Name)
        wait(1)
    end
end)

Ad

Answer this question