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

It won't play the animation for some reason?

Asked by 4 years ago
local player = game.Players.LocalPlayer
game.Players.PlayerAdded:Connect(function(plr)
    plr.Chatted:Connect(function(msg)
        local animation = game.StarterPack.LocalScript.Blue
        local character = plr.Character
        local hum = character.Humanoid
        if msg == "/e dab" then
            local track = hum:LoadAnimation(animation)
            track:Play()
        end
    end)
end)
0
Local scripts can not play animations (assuming your game is filtering enabled), that's the only reason I can think of. cmgtotalyawesome 1418 — 4y
0
Local scripts can play animations. Their actually supposed to be used in local scripts. ^ Alphexus 498 — 4y
0
Check anim's Priority tomekcz 174 — 4y

2 answers

Log in to vote
0
Answered by
Velsity 218 Moderation Voter
4 years ago
Edited 4 years ago

It's because playeradded have some problems being used on the client side. I fixed your script, it should work now. Also, animations are able to work on the local side as the player controls all their movements.

local player = game.Players.LocalPlayer
    player.Chatted:Connect(function(msg)
        local animation = game.StarterPack.LocalScript.Blue
        local character = player.Character
        local hum = character.Humanoid
        if msg == "/e dab" then
            local track = hum:LoadAnimation(animation)
            track:Play()
     end
end)
0
Playeradded can be used in the client side but it has some issues with studio. Check wiki. Alphexus 498 — 4y
0
Weird, I've never heard of that. But I updated my answer. Velsity 218 — 4y
Ad
Log in to vote
0
Answered by
Alphexus 498 Moderation Voter
4 years ago

First of all, I would like to say that there is no error in your script. Playeradded can sometimes have issues in the client side, but it works if you know how. Also I believe that the chatted event can be used better in a server script. Copy your code onto a script in serverscriptservice and delete the first line: “local player = game.Players.LocalPlayer”. With the player parameter from playeradded event, you should get the character. From there you should be good. Any problems, don’t hesitate to comment back. Also it’s recommended to use animations from client side so you could fire the client and play animation from the client. Thanks!

Answer this question