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)

1 comment
Yo thanks! I was just wondering how to modify It so It damages NPCS as well