#tool animation

1 messages · Page 1 of 1 (latest)

hard sparrow
#

I have a tool with no handle and i've defined the functions but for some reason it doesnt play.

tidal estuary
#

Check console for errors

hard sparrow
#

there is none

#

@tidal estuary

sonic sparrow
#

I usually insert a tiny, invisible, non-collidable part to combat this.

hard sparrow
#

ill try that

wheat pulsar
#

local tool = script.Parent
local player = game.Players.LocalPlayer

local function onEquipped()
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:FindFirstChildOfClass("Animator")

local replicatedStorage = game:GetService("ReplicatedStorage")
local animFolder = replicatedStorage:WaitForChild("AnimFolder")
local punchAnim = animFolder:WaitForChild("Animation")

local punchTrack = animator:LoadAnimation(punchAnim)

tool.Activated:Connect(function()
    if punchTrack.IsPlaying then
        punchTrack:Stop()
    end
    punchTrack:Play()
end)

end

if tool:IsDescendantOf(player.Character) then
onEquipped()
else
tool.Equipped:Connect(onEquipped)
end