What do you want to achieve?
I want to make it so the animation works after the player respawns
What is the issue?
I have an equip torch script which adds the torch model via a script in serverscriptservice and plays the animations through a local script.
the problem is that after the player dies, the animations don’t work anymore.
what it should look like:
what it looks like after respawning:
What solutions have you tried so far?
i’ve looked on devforum and the only solution that i’ve thought of is to move the animation and humanoid finding variables(?) inside the function instead so it looks for the humanoid each time the function is fired. however this didn’t work as the animations weren’t stopping and were just overlapping instead
local Service = game:GetService("UserInputService")
local players = game:GetService("Players").LocalPlayer
local par = script.Parent
local debounce = false
local animlibaray = game.ReplicatedStorage.Libraries.Animations.Torch
local char = players.Character or players.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local equipanim = hum.Animator:LoadAnimation(animlibaray.TorchEquipAnim)
local equipidle = hum.Animator:LoadAnimation(animlibaray.TorchEquippedAnim)
local unequipanim = hum.Animator:LoadAnimation(animlibaray.TorchUnEquipAnim)
function torchequip()
if debounce == false then
debounce = true
game.ReplicatedStorage.Events:WaitForChild("TorchEquipEvent"):FireServer(false)
equipanim:Play()
wait(0.8)
equipidle:Play()
equipanim:Stop()
else
debounce = false
game.ReplicatedStorage.Events:WaitForChild("TorchEquipEvent"):FireServer(true)
equipidle:Stop()
unequipanim:Play()
end
end
---------------------------------------
Service.InputBegan:Connect(function(KeyboardInput)
if KeyboardInput.KeyCode.Name == "F" then
torchequip()
wait(1)
end
end)
script.Parent.MouseButton1Click:Connect(function()
torchequip()
wait(1)
end)
local equipanim = hum.Animator:LoadAnimation(animlibaray.TorchEquipAnim)
local equipidle = hum.Animator:LoadAnimation(animlibaray.TorchEquippedAnim)
local unequipanim = hum.Animator:LoadAnimation(animlibaray.TorchUnEquipAnim)
This is where you load the animations for the Humanoid, now what we need to do is reload the animation, so my question is simple, for your gui that this is parented to, is ResetOnDeath enabled?