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

Why isn't the animation playing?

Asked by 3 years ago

I made a slide animation for my game. to run it I put a script in StarterCharacterScripts (

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local Animate 
local Humanoid = player.Character:FindFirstChild('Humanoid')

mouse.KeyDown:Connect(function(Key) 
    if Key == "e" then
        print("e pressed")
        local Animation = Instance.new("Animation", player.Character)
        Animation.AnimationId = "rbxassetid://6383389820"
        Animate = Humanoid:LoadAnimation(Animation)
        Animate:Play()
    end  
end)

) in the debug menu it says "e pressed" so I don't think its a problem with the KeyDown function can anyone help?

0
Thats happening also with me. My press c to crouch stopped playing the animation some hours ago. I think this is a roblox outdown or something so hopefully later will be fixed. LyricalFrog3 45 — 3y
0
Maybe it was an issue with the animation being a core type animation? CrunchChaotic 139 — 3y
0
i set the animation to be type Movement ayuu_ondev 60 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

I think your problem is that you cannot add a localplayer inside of a server script maybe try making it a localscript or use the PlayerAdded and characterAdded let me show you

game.Players.PlayerAdded:Connect(function(player)
    player.Character.CharacterAdded:Connect(function(character)
        local mouse = player:GetMouse()
        local humanoid = character:WaitForChild('Humanoid')
        local animate
        mouse.KeyDown:Connect(function(Key)
            if Key == 'e' then
                print('e pressed')
                local animation = Instance.new('Animation', character)
                animation.AnimationId = "rbxassetid://6383389820"
                animate = humanoid:LoadAnimation(animate)
                animate:Play()
            end
        end)
    end)
end)

or maybe try a localscript but again this is confusing and i get your problem hope this somewhat helps

0
I tried making it both a localscript and a script but neither worked ayuu_ondev 60 — 3y
Ad

Answer this question