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

I have a localscript in a weapon that loads an idle anim but doesnt work after dying, help?

Asked by
FBS_8 25
4 years ago

Script:

local plr = game:GetService("Players").LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local h = char:WaitForChild("Humanoid")
local anim = h:LoadAnimation(script.Parent:WaitForChild("IdleAnim"))
local sound1 = script.Parent.LSound1
local sound2 = script.Parent.LSound2    

local tool = script.Parent

tool.Equipped:Connect(function()
 anim:Play()
 sound1:Play()
end)

tool.Unequipped:Connect(function()
 anim:Stop()
 sound2:Play()
end)
0
Have a function for when the Player dies. Hook a function to the player's Humanoid.Died function and then reload the animation into the humanoid after the player has respawned. rhettsmith6537 109 — 4y
0
Forgot to mention something. In that function you need to wait until the players character has loaded in, so use plr.CharacterAdded:Wait() somewhere. rhettsmith6537 109 — 4y
0
Fixed it already FBS_8 25 — 4y

Answer this question