Hi, I have this damage script I made and it works, but it also damages my self.
script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid")~= nil then hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 25 script.Parent:remove() end end)
How would I go about fixing this issue? Any help would be appreciated. -A newbie Scripter
script.Parent.Touched:connect(function(hit) local player = game.Players:GetPlayerFromCharacter(hit.Parent) if hit.Parent:FindFirstChild("Humanoid")~= nil and player.UserID ~= 00000 then -- change 00000 with your id hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 25 script.Parent:remove() end end) end)