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

Press a key to play a animation?

Hey I am making a game and wrote a script to play a emote when you press a key and it does work in studio but in the the game (not in studio test) it dosent work this is my script


local player = game.Players.LocalPlayer or game.Players.PlayerAdded:Wait()
local character = player.Character or player.CharacterAdded:Wait()
local Humanoid = character:WaitForChild("Humanoid")
local uis = game:GetService('UserInputService')
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://6712486204"
-- bla bla bla bla
function onKeyPressed(inputObject,gameProcessEvent)
	if inputObject.KeyCode == Enum.KeyCode.R then
		Humanoid:LoadAnimation(anim):Play()
		print("Animation is playing")
	end
end
uis.InputBegan:Connect(onKeyPressed)

2 comments

0

Is the game made by you or by your group? Animations must be created by same owner as the place to be able to load.

0

by my group well published by my group so should i make the animation published aas my group?

2 answers

Unless there is something wrong with your script, it could be that the animation doesn't belong to your account. If that is the case it is unplayable using your key bind.

You COULD make your own animations using the ROBLOX Animator, or find free ones from the Toolbox and upload those if you find that too difficult. It's a learning process to make super detailed animations and can be a pain sometimes. There's even ways to take other people's animations, like the one seen in your script assuming it doesn't belong to you. It's stealing, I know, but in the end I don't think anyone cares. For more info on this DM me at noboundaries1#6198 on Discord for a full walkthrough.

6 comments

0

i literally made ALL those animations

0

i literally made ALL those animations all try the code ur self

0

we can't try it ourselves in studio and expect it to work if we do not own the animations

0

but u can make animationss ur self

0

but u can make animationss ur self

0

but u can make animationss ur self

This can be because the animation you want to play is not made by the creator of the game. You cannot play animations made by users who are not the developers of the game.

What you should do instead is recreate the animation on your own. Here is an useful guide on how to animate using the Roblox animation editor. You can also search up for youtube tutorials on how to animate.

1 comment

0

UMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM i made the animations they dont work in the final game but i made them

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