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

Why does this crash my server?

Asked by 8 years ago

So i was trying to reset every player in my game so i went with a generic loop although it started crashing my game so i just let the loop print the players name if their character existed and it still crashed my game so can anyone give me some insight to why this is happening?

here is the code that crashes the game

function finish()
    wait(5)

    for j, k in pairs(game.Players:GetPlayers()) do
        local c = k.Character

        if c then
            print (c)
            c.Torso:BreakJoints() -- with or without it still crashes
            wait()
        end
    end

    survivorList = {}
    infectedList = {}


    wait(1)

    serverCheck()
end
0
Is there any code surrounding this, potentially code with a while, for, or repeat loop? M39a9am3R 3210 — 8y
0
Where did you place it? KingLoneCat 2642 — 8y
0
no this is the only loop that should be running it follows a repeat until but that hasnt crashed anything ProfessorSev 220 — 8y
0
this is placed in a function named finish only a wait(5) proceeds it in the method ProfessorSev 220 — 8y
View all comments (2 more)
2
Can you show more of the code? What you provided should not be crashing your game. M39a9am3R 3210 — 8y
2
I noticed at the bottom it says serverCheck(). Could you show us what is in that function? lightpower26 399 — 8y

Answer this question