This is my script, it's for killing & animating.
local CanAttack = true
local sound = script.Parent.Sound
script.Parent.Activated:connect(function()
local attack = script.Parent.Parent.Humanoid:LoadAnimation(script.Crowbarhit2)
if CanAttack == true then
attack:Play()
sound:Play()
CanAttack = false
wait(1)
attack:Stop()
sound:Stop()
CanAttack = true>
script.Parent.CanDamage.Value = true
end
end)
[SECOND ONE]
local sound4 = script.Parent.Sound4
script.Parent.blade.Touched:connect(function(p)
if script.Parent.CanDamage.Value == true then
p.Parent.Humanoid:TakeDamage(25)
sound4:Play()
script.Parent.CanDamage.Value = false
end
end)
but It works, but I don't know how to make it so no Teamkilling happens.

11 comments
Not sure if I'm doing this right, but I put this I think where you said to
But it did not work
In between line 2 and 3 of second script
I posted what I did to "fix it" but it didn't work, could you elaborate on where to add it in the script?
Whoops, change “canAttack” to “canDamage”
Also, did you make localplayer a variable that has the local player in it?
Oh wait, should I be using a localscript? For this I was using a script? It says consider changing it to local, I'm not a scripter, I don't have one for my game ATM, so I'm kind of improvising
I'll post the new one that's still not working below.
Since its a tool, at the beginning, set the player to script.Parent.Parent
My script isn't functioning, could you edit your post and just post the fixed one for me? If so thanks :)
Nexanian? It doesnt work...// local sound4 = script.Parent.Sound4 local player = script.Parent.Parent script.Parent.blade.Touched:connect(function(p) local hitPlayer = game.Players:GetPlayerFromCharacter(p.Parent) local canDamage = hitPlayer.Team ~= LocalPlayer.Team if canDamage then p.Parent.Humanoid:TakeDamage(25) sound4:Play() script.Parent.CanDamage.Value = false end end)