-
What do you want to achieve? I want my module script to refresh the humanoid and character.
-
What is the issue? I use a module script to load the players animations for tools but after the player dies the table does not update the humanoid it uses therefore rendering it useless. I know the table works for animations and the only reason I use it is because if I don’t load it in a universal variable I will have to load a new animation through every script which is going to cause issues.
-
What solutions have you tried so far? I’ve tried using character adding and updating the character variable and humanoid but I dont think that it updates the table of animations. I’ve also tried putting the table into the character added event but It doesn’t register the table.
Script:
player = game.Players.LocalPlayer
char = player.Character or player.CharacterAdded:Wait()
player.CharacterAdded:Connect(function(character)
char = character
end)
local human = char:WaitForChild(‘Humanoid’)
local animations = {
slide = human.Animator:LoadAnimation(script.SlideAnim),
handgunIdle = human.Animator:LoadAnimation(script.Handgun_Idle),
handgunFire = human.Animator:LoadAnimation(script.Handgun_Fire),
handgunReload = human.Animator:LoadAnimation(script.Handgun_Reload),
jumpKick = human.Animator:LoadAnimation(script.JumpKick),
canSprint = true
}
return animations