function onDamage(Part)
if Part.Parent:findFirstChild("Humanoid") ~= nil and not game.Players:GetPlayerFromCharacter(Part.Parent) ~= game.Players.LocalPlayer then
script.Disabled = true
for i = 1, 3 do
Part.Parent.Humanoid.Health = Part.Parent.Humanoid.Health -5
Part.Parent.Humanoid.Sit = true
wait(0.05)
end
Part.Parent.Humanoid.Sit = false
script.Parent:remove()
end
wait(0.025)
end
script.Parent.Touched:connect(onDamage)
There, fixed
It checks if the player that the character which is getting hurt is not the LocalPlayer. If it isn't, it hurts the character. |