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

If the animation ID is the problem, how to I get the real one?

local enabled = true
Player = script.Parent.Parent
--Player:WaitForDataReady()
mouse = Player:GetMouse()
run = game:GetService("RunService")
function onKeyDown(key)
if not enabled then return end
enabled = false
	key = key:lower()
	if key == "z" then

local animation = Instance.new("Animation")
		animation.AnimationId = "b126ab943d35e9b7e3bb92379d9504d7"

	local animTrack = humanoid:LoadAnimation(animation)
			animTrack:Play()

	end 	
end

enabled = true


mouse.KeyDown:connect(onKeyDown)

Im not sure if the animation is stopping it from working or if it is the OnKeyDown, please help.

6 comments

0

Is the script local?

0

No.

0

Is it meant to be?

0

Not exactly, but's it's recommended. It's easier to find the player in a local script using LocalPlayer.

0

Also, to get the animation, press export in the animation editor. It will cost you some robux though.

0

How would I get the asset ID?

1 answer

To get your asset Id you need to Export the animation. Do this by going to the animation editor > (Make your animation) Click the + in th upper left hand corner > Click export. When it is finished uploading go to your inventory > Animations > (your animation) Now copy the numbers at the end of the link.

Put the numbers in the script like so:

local enabled = true
Player = script.Parent.Parent
--Player:WaitForDataReady()
mouse = Player:GetMouse()
run = game:GetService("RunService")
function onKeyDown(key)
if not enabled then return end
enabled = false
    key = key:lower()
    if key == "z" then

local animation = Instance.new("Animation")
        animation.AnimationId = "http://www.roblox.com/asset/?id=218192180" --218192180 is an example. Replace it with your ID

    local animTrack = humanoid:LoadAnimation(animation)
            animTrack:Play()

    end     
end

enabled = true


mouse.KeyDown:connect(onKeyDown)

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