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

why does my animation work in studio and not the actual game?

Asked by
kyaryx 0
3 years ago

I was making an animation in a game for fun and when I went to test it in studio it worked fine. but then I opened the actual game it's in and when I press the button for it it doesnt play. here is the code.

         Animation = Instance.new("Animation")
        Animation.Parent = game.Workspace
        Animation.AnimationId = "http://www.roblox.com/asset/?id=6489471322"
        local Player = game.Players.LocalPlayer
        local mouse = game.Players.LocalPlayer:GetMouse()
    mouse.KeyDown:connect(function (key)
            for i, v in pairs(game.Players:GetChildren()) do
                if key == "f" then
                        local AnimationTrack = Player.Character.Humanoid:LoadAnimation(Animation)
                            AnimationTrack:Play()
                    end
                end
            end)

Answer this question