Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why isn't the animation playing?

I made a slide animation for my game. to run it I put a script in StarterCharacterScripts (

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local Animate 
local Humanoid = player.Character:FindFirstChild('Humanoid')

mouse.KeyDown:Connect(function(Key) 
	if Key == "e" then
		print("e pressed")
		local Animation = Instance.new("Animation", player.Character)
		Animation.AnimationId = "rbxassetid://6383389820"
		Animate = Humanoid:LoadAnimation(Animation)
		Animate:Play()
	end  
end)

) in the debug menu it says "e pressed" so I don't think its a problem with the KeyDown function can anyone help?

3 comments

0

Thats happening also with me. My press c to crouch stopped playing the animation some hours ago. I think this is a roblox outdown or something so hopefully later will be fixed.

0

Maybe it was an issue with the animation being a core type animation?

0

i set the animation to be type Movement

1 answer

I think your problem is that you cannot add a localplayer inside of a server script maybe try making it a localscript or use the PlayerAdded and characterAdded let me show you

game.Players.PlayerAdded:Connect(function(player)
	player.Character.CharacterAdded:Connect(function(character)
		local mouse = player:GetMouse()
		local humanoid = character:WaitForChild('Humanoid')
		local animate
		mouse.KeyDown:Connect(function(Key)
			if Key == 'e' then
				print('e pressed')
				local animation = Instance.new('Animation', character)
				animation.AnimationId = "rbxassetid://6383389820"
				animate = humanoid:LoadAnimation(animate)
				animate:Play()
			end
		end)
	end)
end)

or maybe try a localscript but again this is confusing and i get your problem hope this somewhat helps

1 comment

0

I tried making it both a localscript and a script but neither worked

This discussion is preserved as it was. New answers, comments, and votes are closed.