Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can somebody help me with this animation?

Asked by
neoG457 315 Moderation Voter
9 years ago
local enabled = true
mouse = Player:GetMouse()
function onKeyDown(key)
if not enabled then return end
enabled = false
    Key = key:lower()
    if key == "x" then

local animation = Instance.new("Animation")
    animation.AnimationId = "http://www.roblox.com/Asset?ID=220836646"

        local player = game.Players.LocalPlayer.Character


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


        wait(2)
    enabled = true
end

            mouse.KeyDown:connect(onKeyDown)


I''ve been told that I havent defined the player correctly, how do I do this?

1 answer

Log in to vote
0
Answered by
yumtaste 476 Moderation Voter
9 years ago

Define Player by putting the code local Player = game.Players.LocalPlayer on line 1, and you forgot to put an end on line 22 to close the "if key" statement. Also, animations need to be triggered by LocalScripts, so put this code in a LocalScript and put it it in StarterGui.

Ad

Answer this question