Player = game.Players.LocalPlayer
Character = Player.Character
local rightArm = Character['Right Arm']
local debounce = false

rightArm.Touched:Connect(function(Hit)
        Hit.Parent:FindFirstChild("Humanoid"):TakeDamage(50)
            if not debounce and Hit.Parent:FindFirstChild("Humanoid").Health <= 0 then
				debounce = true
                Player.leaderstats.Kills.Value = Player.leaderstats.Kills.Value + 1
				wait(1)
				debounce = false
				
        end
    end)

There's my code, for some reason the rightArm portion conflicts with something so that the code doesn't run in-game.

4 comments

0

Changes made to the humanoid's health locally will not be replicated to the server, meaning that you cant set the health of a character locally nor change the value of a value object. Use Remote Events/Functions to handle this for you.

0

So, use RemoteEvents to trigger another script that will damage the health of a character publicly?

0

Yes, make sure that the other script is a server script. Also you should be changing your leaderstat value objects in the server script as well.

0

Got it.