So, i created a fighting game, it’s kinda popular but there’s this bug which i can’t fix, i really got no idea on how to do that. Sometimes when people leave the game their character stays in-game. They aren’t in-game anymore but their avatar model is still there, also if someone attacks the empty model, they get bugged.
2 Likes
Maybe try adding that bug as a special game mechanic. You should still fix this though:
I’m not sure how to do that but I hope I helped with the first part!
What i would do is connect a function to the PlayerRemoving event. make it wait a couple of seconds and then see if their character is still in the game. If so, you destroy it.
you just need to attach AncestryChanged to the player object and remove it if the ancestory changed of the player object. something like this
game.Players.PlayerAdded:connect(function(plr) --hope you already have this part in the custom model thingy
plr.AncestryChanged:connect(function()
print(plr, "Left the server")
-- there player left the server, you can now remove the model that he had aka character.
end)
end)
1 Like