Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

No error, tryingt to add 1 to a leaderstat after player has died?


game:GetService('Players').PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		character:WaitForChild("Humanoid").Died:Connect(function()
print("h")
			player.leaderstats.Deaths.Value = player.leaderstats.Deaths.Value + 1

		end)
	end)
end)


3 comments

1

Is this a local script, or a server script?

0

local

1

Oh

1 answer

✓ Accepted answer

Put this script in ServerScriptService:

game:GetService("Players").PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		char:WaitForChild("Humanoid").Died:Connect(function()
			player.leaderstats.Deaths.Value = player.leaderstats.Deaths.Value + 1
		end)
	end)
end)

Hope it helps!

2 comments

1

Make sure it is a normal script, not a local one

0

aa, thanks

This discussion is preserved as it was. New answers, comments, and votes are closed.