local tool = script.Parent
local handle = script.Parent:WaitForChild('Handle')
local Debounce = true
local slash = script.Parent:WaitForChild('Slash')
local click = false
local inAttack = false
AniDebounce = true
AxeDebounce = true
tool.Activated:connect(function()
local plr = game.Players:GetPlayerFromCharacter(tool.Parent)
local char = plr.Character
if char then
local hum = char:WaitForChild('Humanoid')
local slashTrack = hum:LoadAnimation(slash)
wait(0.1)
if AniDebounce then
slashTrack:Play()
AniDebounce = false
end
end
inAttack = true
if Debounce then
Debounce = false
click = true
print('tool activated')
local plr = game.Players:GetPlayerFromCharacter(tool.Parent)
if plr then
handle.Touched:connect(function(hit)
if inAttack then
print('animation')
-- Animation
local char = plr.Character
if char then
local hum = char:WaitForChild('Humanoid')
local slashTrack = hum:LoadAnimation(slash)
wait(0.1)
if AniDebounce then
slashTrack:Play()
AniDebounce = false
end
end
-- Tree damage
if hit.Parent and hit.Parent.Name ~= plr.Name and hit.Parent:FindFirstChild('Wood') and AxeDebounce then
AxeDebounce = false
local HP = hit.Parent.HP
HP.Value = HP.Value - 30
end
else
print(Debounce)
print(click)
end
end)
end
wait(0.5)
click = false
inAttack = false
wait(5)
Debounce = true
end
end)
while wait() do
if AniDebounce == false then
wait(2)
AniDebounce = true
AxeDebounce = true
end
end
This is a server script inside a tool in starterpack, this works fine in local servers and test server but refuses to work in real game with error animation ... failed to load in ... (basicly humanoid) maybe I haven't waited long enough for roblox to approve it but that doesn't make sense as I made it about 8 hours ago...
