Hello! I need a hand, the ball is an instance of part
How can I prevent harm to myself?
I would like to be able to damage other players but not myself, how can i do it?
Video example:
Project Organization:
back_SnowBall script:
-- Touch Function for
ball.Touched:Connect(function(hit)
ball:Destroy()
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
local char = player.Character
local humanoid = char:FindFirstChild("Humanoid")
if hit.Parent ~= nil then
if humanoid ~= nil and not humanoid:IsDescendantOf(script.Parent) then
humanoid.Health = humanoid.Health - damage
end
end
end
end)