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

Animation won't play but the output shows no errors?

Asked by
KenzaXI 166
8 years ago
repeat wait() until game.Players.LocalPlayer and game.Players.LocalPlayer.Character
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()  
Mouse.KeyDown:connect(function(Key)
    if Key == "q" then
        local Animation = Instance.new("Animation")
        Animation.AnimationId = "http://www.roblox.com/Asset?ID=281476213"
        local animTrack = Player.Character.Humanoid:LoadAnimation(Animation)
        animTrack:Play()
    end
end)


Thanks for the help!

1 answer

Log in to vote
0
Answered by 8 years ago

I'll fix your errors.. You put

repeat wait() until game.Players.LocalPlayer and game.Players.LocalPlayer.Character
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()  
Mouse.KeyDown:connect(function(Key)
    if Key == "q" then
        local Animation = Instance.new("Animation")
        Animation.AnimationId = "http://www.roblox.com/Asset?ID=281476213"
        local animTrack = Player.Character.Humanoid:LoadAnimation(Animation)
        animTrack:Play()
    end
end)

Try it THIS way

wait(2) -- Wait

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()  
local anim = Player.Character.Humanoid:LoadAnimation(game.StarterPack.LocalScript.Animation)

Mouse.KeyDown:connect(function(Key)
    if Key == "q" then
        anim:Play()
    end
end)



OR this way..

repeat wait() until game.Players.LocalPlayer and game.Players.LocalPlayer.Character
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()  
Mouse.KeyDown:connect(function(Key)
    if Key == "q" then
        Instance.new("Animation")
        Animation.AnimationId = "http://www.roblox.com/Asset?ID=281476213"
wait(1)
        Player.Character.Humanoid:LoadAnimation(Animation)
        animTrack:Play()
    end
end)

I didn't test these, I believe I made a mistake. Let me know if I did and I'll fix it for you. I'm a newbie scripter btw.

0
Nope won't work. KenzaXI 166 — 8y
0
Fine.. I'll just update my scripts to something that I use, My own scripts that work. james24dj 90 — 8y
Ad

Answer this question