I've been trying been trying for a while now on how to get these animations to load ingame but they just wont, they work perfectly in studio but not in game, any thoughts? ;-; Help

repeat wait() until game.Players.LocalPlayer.Character~=nil
local plr=game.Players.LocalPlayer
local chr=plr.Character
local hum=chr:WaitForChild("Humanoid")
local UserInput=game:GetService("UserInputService")


local crtAnimation


local normalSpeed=16

local animationsList={
	[Enum.KeyCode.V] = {hum:LoadAnimation(script:WaitForChild("Atease")),16}, 
	[Enum.KeyCode.M] = {hum:LoadAnimation(script:WaitForChild("Sit")),0}, 
	[Enum.KeyCode.N] = {hum:LoadAnimation(script:WaitForChild("Lean on wall")),0}, 
	[Enum.KeyCode.Q] = {hum:LoadAnimation(script:WaitForChild("Salute")),16}, 
	[Enum.KeyCode.X] = {hum:LoadAnimation(script:WaitForChild("Surrender")),0}, 
	[Enum.KeyCode.Z] = {hum:LoadAnimation(script:WaitForChild("Lay down")),0}, 
	[Enum.KeyCode.B] = {hum:LoadAnimation(script:WaitForChild("Kneel")),0}, 

}
local function StopAllAnims()
	for _,v in pairs(animationsList) do
		if crtAnimation~=v[1] and v[1].IsPlaying then v[1]:Stop() end
	end
end
UserInput.InputBegan:connect(function(input) 
	if animationsList[input.KeyCode] ~= nil and UserInput:GetFocusedTextBox()==nil then
		if animationsList[input.KeyCode][1] ~= crtAnimation then
			crtAnimation=animationsList[input.KeyCode][1]
			hum.WalkSpeed=animationsList[input.KeyCode][2]
				StopAllAnims()
			crtAnimation:Play()
		else
			hum.WalkSpeed=normalSpeed
			crtAnimation=nil
			StopAllAnims()
		end
	end
end)

1 comment

0

do you get an error if so what is it