How to detect player:LoadCharacter

  1. What do you want to achieve? Keep it simple and clear!
    So I want to reset all the points when a round is over, everything is working fine until I notice that the points doesn’t get rest because I use load character instead of just making humanoid health to 0 because it is faster

  2. What is the issue? Include screenshots / videos if possible!
    The issue is now that I use load character the points doesn’t get reset because I use humanoid.died event

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    tried searching but still can’t find

thanks in advance

1 Like

When you’re describing your problem, you need to provide the necessary context in order for us to help. How is your game storing points? What is the gameplay you’re trying to make? No amount of context is too much.

Sorry for not explaining it well enough, but basically my game is a round based “minigame” game where player collect points inside the round and when the round ends player with the most points wins. I store the points value inside the player and when player die the points reset so everytime the round ends I reset every player so the points also reset but the problem is I decided to use player:loadcharacter instead of just making humanoid health to 0 so now I think the script that detect humanoid died doesn’t detect anymore because I use player:loadcharacter so I want to find a way to detect player:loadcharacter (sorry for bad grammar)

Ah, that makes more sense. Context always helps!

It sounds like you need to unify your “player was eliminated” logic into one function. Something like:

function eliminate(player)
    player.Points.Value = 0
    player:LoadCharacter() -- Or kill them, which causes a respawn, etc
    -- Maybe consider showing a message like "So-and-so was eliminated!"
end

Then instead of loading their character to eliminate them, you instead do eliminate(player) or similar. Basically, instead of trying to detect something you’re already using, change what you’re using entirely.

1 Like
for _, plr in ipairs(game.Players:GetPlayers()) do
	if plr then
		local ls = plr:FindFirstChild("leaderstats")
		if ls then
			local stat = ls:FindFirstChild("Stat")
			if stat then
				stat.Value = 0
			end
		end
	end
end

This is how most round-based games would go about resetting stats. Just traversing over each player and resetting the stat’s value back to 0 (this should be executed whenever the round ends).