Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I change the walk animation while equipping a tool?

Asked by 4 years ago
Edited 4 years ago

I tried using the below code in a localscript parented to the tool and nothing changed, no errors.

local walkId = 'http://www.roblox.com/asset/?id=5363264679'
local defaultWalk = 'http://www.roblox.com/asset/?id=180426354'

tool.Equipped:Connect(function()
    idle:Play()
    character:WaitForChild('Animate').walk.WalkAnim.AnimationId = walkId
end)

tool.Unequipped:Connect(function()
    idle:Stop()
    character:WaitForChild('Animate').walk.WalkAnim.AnimationId = defaultWalk
end)

EDIT: I also tried rbxassetid://id but nothing changed.

EDIT: When I unequip the tool the walking animation plays

EDIT: Here is the updated script:

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local animate = character:WaitForChild('Animate')

tool.Equipped:Connect(function()
    animate.walk.WalkAnim.AnimationId = 'http://www.roblox.com/asset/?id=5363264679'
    animate.idle.Animation1.AnimationId = 'http://www.roblox.com/asset/?id=5352409799'
    animate.idle.Animation2.AnimationId = 'http://www.roblox.com/asset/?id=5352409799'
    animate.Disabled = true
    animate.Disabled = false
end)

tool.Unequipped:Connect(function()
    animate.walk.WalkAnim.AnimationId = 'http://www.roblox.com/asset/?id=180426354'
    animate.idle.Animation1.AnimationId = 'http://www.roblox.com/asset/?id=180435571'
    animate.idle.Animation2.AnimationId = 'http://www.roblox.com/asset/?id=180435792'
    animate.Disabled = true
    animate.Disabled = false
end)

and here is a gyazo of what happens https://gyazo.com/a39d61746d32e7aa58482b54cf524a9b

0
Can you show me the most recent version of this script? rabbi99 714 — 4y
0
Also the full script please! rabbi99 714 — 4y
0
@rabbi99 hi i forgot to check i fell asleep as soon as i published this question but i updated it, the only issue now is that it twitches a little while moving and the idle and moving play after you unequip, ill edit the post with the new version, also the full script is just a event firer for the combat so im pretty sure its useless ImUID3558 20 — 4y

Answer this question