function processCommand(speaker, message)
if message == script.MessageComand.Value then
local bro = game.Workspace:FindFirstChild(speaker.Name)
local newanim = script.AnimationOne:Clone()
newanim.Parent = bro
local hum = newanim.Parent.Humanoid
local anim = hum:LoadAnimation(bro.AnimationOne)
anim:Play()
newanim:Destroy()
if
end
end
game.Players.PlayerAdded:connect(function(player)
player.Chatted:connect(function(message)
processCommand(player, message)
end)
function processCommand(speaker, message)
if message == script.MessageComand.Value then
local bro = game.Workspace:FindFirstChild(speaker.Name)
local newanim = script.AnimationOne:Clone()
newanim.Parent = bro
local hum = newanim.Parent.Humanoid
local anim = hum:LoadAnimation(bro.AnimationOne)
anim:Play()
newanim:Destroy()
wait(amount of time you want to wait)
anim:Stop()
end
end
Code with bad practices aside, this probably has to do with your animation. Did you make it loop? You can either turn looping off or turn the property off in code:
-- Append this below anim:Play()
anim.Looped = false
Otherwise, aside from that, the animation priority is most likely too high. You have to stop this yourself when a user’s state changes - that’s not accounted for in your code.
Not sure why you are suggesting waits. Waits don’t have anything to do with whether or not an animation stops. There’s no need to even have a wait statement present in this code.
@NYDynamics
No it’s not and you shouldn’t be using wait with this in mind. Wait sleeps the thread from executing for a specified amount of time. If n is not specified, it will wait approximately 1/30th of a second.
Or you can not reinvent the wheel and use game.Loaded:Wait() instead. The Loaded signal and IsLoaded method determine when the server finishes replicating instances to the client.
The whole point on wait/Loaded is irrelevant for the purposes of this thread in the first place. It’s about stopping an animation.
What exactly do you mean by “Roblox doesn’t load in time”? Wait doesn’t prevent anything. If you need to use a wait unnecessarily in your code, you are writing your code wrong (and the point is wrong as well). There’s no such scenario.
Again, this is irrelevant for the purposes of the OP. Please DM me if you wish to continue further discussion.
I’ve been trying all of the stuff you’ve all been saying, but either the emote stays looped even while walking or cancels out while walking but cancels out while idea which is not what I want.
I want my emote to loop while being idle but cancel out when walking or jumping. Please give me other ideas to fix it ;-;
I tried using Idle, it acts the same as movement and action, when I use core, I can use the emote when I just spawn but when I move I can’t use the emote, and the scripts to make it idle or loop or not don’t work…
function processCommand(speaker, message)
if message == script.MessageComand.Value then
local bro = game.Workspace:FindFirstChild(speaker.Name)
local newanim = script.AnimationOne:Clone()
newanim.Parent = bro
local hum = newanim.Parent.Humanoid
local anim = hum:LoadAnimation(bro.AnimationOne)
anim:Play()
end
end
humanoid.Jumping:Connect(function()
anim:Stop();
end);
if (speed < 0.1) then
return;
end
anim:Stop();
end);
But that final end says expected eof instead of end
I got rid of the end issue but now the script says
attempt to index global ‘humanoid’ (a nil value)
and it says that to humanoid, anim, speed, and the other anim in the bit of coding you gave me, why are those things “a nil value”