Why is my code not damaging other players?
This script is meant to damage everyone except the local player, but instead it does not damage anything. I already tried everything I could think of, anyone have an idea on what to do?
02 | local function ontouch(hit) |
03 | if hit.Parent:FindFirstChild( "Humanoid" ) then |
04 | local hum = hit.Parent:FindFirstChild( "Humanoid" ) |
05 | local players = game.Players:GetPlayers() |
08 | local player = players [ i ] |
09 | repeat wait() until player.Character~ = nil |
10 | if player.Character = = hum.Parent then |
13 | if hit.Parent:FindFirstChild( "Humanoid" ) ~ = player.Character.Humanoid then |
14 | print (hit.Parent:FindFirstChild( "Humanoid" ).Parent) |
18 | if hit.Parent:FindFirstChild( "Humanoid" ) = = player.Character.Humanoid then |
20 | print (hit.Parent:FindFirstChild( "Humanoid" ).Parent) |
27 | script.Parent.Touched:Connect(ontouch) |