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

How can I make my emote stop playing when the player moves?

Asked by 6 years ago

Soo I got this script that plays an animation whenever the player says: '/e bouncydance'.

game.Players.PlayerAdded:connect(function(Plr)
Plr.Chatted:connect(function(msg)
if msg == "/e bouncydance" then
A = Instance.new("Animation", Plr.Character)
A.AnimationId = "rbxassetid://1746899451" 
track = Plr.Character.Humanoid:LoadAnimation(A)
track:Play()
end
end)
end)

The problem is that when the player moves the animation keeps on playing. Could you please tell me what to add so the emote stops playing when the player moves?

Thank you :>

0
When you were making the animation, what priority did you set it at? The core priority should make it stop when the player moves, whereas the Action priority shouldn't stop. TheBenSquare 47 — 6y
0
Btw, the second arg (parent) from instance.new is deprecated, don't use it anymore.. User#20388 0 — 6y

2 answers

Log in to vote
1
Answered by
hellmatic 1523 Moderation Voter
6 years ago
Edited 6 years ago
game.Players.PlayerAdded:connect(function(Plr)
    Plr.Chatted:connect(function(msg)
        if msg == "/e bouncydance" then
            A = Instance.new("Animation", Plr.Character)
            A.AnimationId = "rbxassetid://1746899451" 
            track = Plr.Character.Humanoid:LoadAnimation(A)
            track:Play()

            Plr.Character.Humanoid.Running:connect(function(speed)
                if speed > 0 then 
                    track:Stop()
                end
            end)
        end
    end)
end)

0
Thank you so much! You're the best! User#22192 0 — 6y
Ad
Log in to vote
0
Answered by 6 years ago
game.Players.PlayerAdded:connect(function(Plr)
Plr.Chatted:connect(function(msg)
if msg == "/e bouncydance" then
A = Instance.new("Animation", Plr.Character)
A.AnimationId = "rbxassetid://1746899451" 
track = Plr.Character.Humanoid:LoadAnimation(A)
track:Play()
end
end)
end)
game.Workspace.Player.Humanoid.Running:connect(function(speed)
    if speed > 0 then
        track:stop()
    end

Hope this is helped you!

0
Thank you for answering! Unfortunately, it is still not working, but thanks! User#22192 0 — 6y
0
Ohhh i sorry for wrong answering :( I'll try my best! MEndermanM 73 — 6y

Answer this question