Player removing function delayed

basicly everytime i leave my game, it takes 20+ seconds for

game.Players.PlayerRemoving:connect(function(plr)
       print("left")
end

that print statement to hit, and ive looked everywhere through my code over and over again and cant seem to figure out why its doing this, doesnt matter if i put the script somewhere else or anything

1 Like

Are you playtesting this through studio by yourself?

2 Likes

Try running the script in the real game (requires another player) and in studio. Studio often has weird delays like these.

game.Players.PlayerRemoving:Connect(function(player)
    print(game:GetService("RunService"):IsStudio() and "studio" or "ingame")
end)
2 Likes

nah its in the actual game, in studio it works instantly

2 Likes

what does this do exactly? i gotta typpe atleast thrty charachters

2 Likes

Sounds like leaving causes the server to lag? You dont get any timeout errors i assume?

1 Like

yea no timeout errors, i legit just put playerremoving function and then print statement after and then ofc end, but it doesnt hit at all, until like 20 seconds after my other account leaves that i bring in so i can see dev console while player leaves, and legit nothing will happen, player that left sits there for 20 seconds until the print statement and removing function finaly hit

1 Like