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

When character resets weapon animations stop working?

Asked by 5 years ago

I noticed that after resetting you player weapon animations stop working. Not sure if I have to have a script to where the localscript in the tool resets itself so that way the weapon animations start working again.

Here is the script for the tool (I know I posted this script in the last post but just going to post it here updated and so that way I can have help)

01local plr = game:GetService("Players").LocalPlayer
02local char = plr.Character or plr.CharacterAdded:Wait()
03local h = char:WaitForChild("Humanoid")
04local anim = h:LoadAnimation(script.Parent:WaitForChild("Animation"))
05 
06local tool = script.Parent
07 
08tool.Equipped:Connect(function()
09    anim:Play()
10end)
11 
12tool.Unequipped:Connect(function()
13    anim:Stop()
14end)
0
any output? Gameplayer365247v2 1055 — 5y
0
It's just a lot of stack ends Screaming_Monkeys 4 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago
01game.Players.PlayerAdded:Connect(function(plr)
02    plr.CharacterAdded:Connect(function(char)
03        local h = char:WaitForChild("Humanoid")
04        local anim = h:LoadAnimation(script.Parent:WaitForChild("Animation"))
05 
06        local tool = script.Parent
07        tool.Equipped:Connect(function()
08            anim:Play()
09        end)
10 
11        tool.Unequipped:Connect(function()
12            anim:Stop()
13        end)
14    end
15end

My solution its just reload the script everytime the character gets reloaded.

Ad

Answer this question