My Loose Points On Death Script Isn't Working

My Loose Points on Death Doesn’t Work.
I Have Tried Putting Humanoid Instead of plr but that didn’t work as expected.
I Don’t Know what the issue is. But Here’s The Script.

image

(This is a script in StarterPlayer.StarterCharacterScripts)

Is it a local script? If so, the value will only update on the client and not the server

nope its a script lemme change that. But This Still wont help cause the actual script doesn’t work

Maybe try this:

local character = script.Parent
local humanoid = character:WaitForChild("Humanoid") -- Waiting for humanoid to load

humanoid.Died:Connect(function() 
	local player = game.Players:GetPlayerFromCharacter(character) -- getting player from their character
	if player then 
		local leaderstats = player:WaitForChild("leaderstats") -- getting leaderstats
		local coins = leaderstats:WaitForChild("Coins") -- getting value (coins) to change
		coins.Value = 0 -- setting value to 0
	end
end)
2 Likes

Why Thank You! This Worked Great

1 Like

This needs to be a server script inside ServerScriptService otherwise the stats will only reflect locally (other clients in the same server will not see the changes to the leaderboard).

The script won’t execute if it’s the wrong type of script in the wrong location, (local scripts can only run in designated areas, similarly server scripts can only run in designated areas too).