I made a crowbar that damages players however won't damages teammates but It appears to attempt with nil, I want It so when your not In a team you can damage everyone but If your not In a team you can damage players, but not your teammate
Script:
local tool = script.Parent local Woosh = tool.Woosh local PANSOUNDNOTCLICKBAIT = tool.PAN local Slash = tool.Slash local Debounce = false local CanDamage = false tool.Activated:Connect(function() if not Debounce then Woosh:Play() Debounce = true CanDamage = true local Hum = tool.Parent.Humanoid local AnimationTrack = Hum:LoadAnimation(Slash) AnimationTrack:Play() wait(0.9) CanDamage = false Debounce = false end end) tool.Handle.Touched:Connect(function(hit) local humanoid = hit.Parent:FindFirstChildWhichIsA("Humanoid") local player1 = game.Players:GetPlayerFromCharacter(hit.Parent) local player2 = game.Players:GetPlayerFromCharacter(tool.Parent) if player1.TeamColor ~= player2.TeamColor then if humanoid and CanDamage == true then humanoid:TakeDamage(10) CanDamage = false humanoid.PlatformStand = true wait(1) humanoid.PlatformStand = false end end end)
local tool = script.Parent local Woosh = tool.Woosh local PANSOUNDNOTCLICKBAIT = tool.PAN local Slash = tool.Slash local Debounce = false local CanDamage = false tool.Activated:Connect(function() if not Debounce then Woosh:Play() Debounce = true CanDamage = true local Hum = tool.Parent.Humanoid local AnimationTrack = Hum:WaitForChild("Animator"):LoadAnimation(Slash) AnimationTrack:Play() task.wait(0.9) CanDamage = false Debounce = false end end) tool.Handle.Touched:Connect(function(hit) local player1 = game.Players:GetPlayerFromCharacter(tool.Parent) local player2 = game.Players:GetPlayerFromCharacter(hit.Parent) if (player1 ~= nil) and (player2 ~= nil) then local humanoid = (player2.Character or player2.CharacterAdded:Wait()):FindFirstChildWhichIsA("Humanoid") if (player1.TeamColor ~= player2.TeamColor) then if (humanoid ~= nil) and CanDamage == true then humanoid:TakeDamage(10) CanDamage = false humanoid.PlatformStand = true task.wait(1) humanoid.PlatformStand = false end end end end)