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

Tool animations do not play after you reset?

Asked by 4 years ago

I have some tools with custom animations such as idle animations and stuff like that. They work flawlessly.

However, when you reset with the tool equipped, the animations just completely break and do not play for me.

Tool working normally, and then resetting: https://gyazo.com/010bdaa18dffd0921ebbeed73db257ad

Tool after resetting: https://gyazo.com/f35019b16345b59ccdc1dbb70f09842a

The error in the output: https://gyazo.com/ca86fad2a96f6c722882990c008ed4c7

Heres the code I use for that tool if it helps:

local Attack = Instance.new("Animation",script.Parent) 
Attack.AnimationId = 'rbxassetid://4574156500'
Attack.Name = "FLAK Attack"

local Idle = Instance.new("Animation",script.Parent) 
Idle.AnimationId = 'rbxassetid://4574118929'
Idle.Name = "FLAK Idle"

local player = game.Players.LocalPlayer
local character

repeat
    character = player.Character
    wait()
until character

local Tool = script.Parent
local hitbox = Tool.Hitbox
local d = false

-- le animating

local attackAnim = character.Humanoid:LoadAnimation(Attack)
local idleAnim = character.Humanoid:LoadAnimation(Idle)

Tool.Equipped:Connect(function()
    idleAnim:Play()
end)

Tool.Activated:Connect(function()
    if d then return end
    d = true
    attackAnim:Play()
    Tool.RemoteEvent:FireServer()
    wait(2.3)
    d = false
end)

Tool.Unequipped:Connect(function()
    attackAnim:Stop()
    idleAnim:Stop()
end)

Any help would be very appreciated!

0
Woops, the gyazo links don't really work. Just highlight everything after https:// comfycouchman 0 — 4y

Answer this question