Problem with self damage

Hello, I have created a projectile that self damages the player who has thrown it

I do not know how to fix it.

the projectile is a clone from the handle

here is the script for the self damage that is flawed

			rock.Touched:Connect(function(hit)
					if hit ~= nil and hit.Parent ~= nil then
				local humanoid = hit.Parent:FindFirstChildOfClass("Humanoid")
				if humanoid then
						humanoid:TakeDamage(25)

Do you guys have any idea on what the problem is? If so, how do I fix it?

You don’t have anything to detect whether the player throwing it is the owner, so

if hit.Parent and hit.Parent.Name ~= tool.Parent.Name and hit.Parent:FindFirstChild("Humanoid") then
	--deal damage
end
1 Like

Yes you were right, I didn’t think of that until now. Thank you very much!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.