Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

The damage part of my script isnt working, even though there are no errors how do i fix this?

Asked by 3 years ago

Hello, im making a fighting game with projectiles. So far everything was going good but i ran into an issue, the name finder works however it doesnt damage other players, any help would be appreciated, one more thing there are no errors in output script.Parent.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then if hit.Parent.Name == script.Parent.Parent.AtkOwner.Value then print("Name finder works") end else if hit.Parent:FindFirstChild("Humanoid") then hit.Parent:FindFirstChild("Humanoid"):TakeDamage "5" end end end)

1 answer

Log in to vote
0
Answered by 3 years ago
script.Parent.Touched:Connect(function(hit) 
    if hit.Parent:FindFirstChild("Humanoid") then 
        if hit.Parent.Name == script.Parent.Parent.AtkOwner.Value then 
            print("Name finder works") 
        end 
    else -- ur saying that you want to damage when its not a player
        if hit.Parent:FindFirstChild("Humanoid") then
            hit.Parent:FindFirstChild("Humanoid"):TakeDamage"5" 
        end 
    end 
end)
Ad

Answer this question