I’m trying to make an NPC do the Baby Dance emote that everyone can see.
I’ve made a script that inserts an animation, loads it into the Humanoid, and plays the emote. This doesn’t work, and no errors appear in the output.
I’ve tried looking at the Developer Forum and Scripting Helpers but haven’t really found anything useful or that worked for what I’m trying to do.
My script is inside the NPC’s humanoid.
local USERID = script:WaitForChild("TOPDONORUSERID").Value
local humanoidDescriptionForUser = game.Players:GetHumanoidDescriptionFromUserId(USERID)
local Humanoid = script.Parent
local Players = game:GetService("Players")
Humanoid:ApplyDescription(humanoidDescriptionForUser)
local humanoidDescription = Humanoid.HumanoidDescription
local Humanoid = script.Parent
local name = Players:GetNameFromUserIdAsync(USERID)
Humanoid.DisplayName = name
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://4272484885"
local animtrack = Humanoid:LoadAnimation(anim)
animtrack.Looped = true
animtrack.Priority = Enum.AnimationPriority.Action
animtrack:Play()
Does anyone know how to fix this, It’s really annoying and I can’t find anything to solve it.
@LukeWasAlreadyTaken changing the animation ID using rbxassetid:// didnt change anything @ekuz0diaa i’ve tried it both anchored and unanchored, nothing. setting the priority changed nothing @CalebbXVI i’ve tried it both with and without being anchored to no avail, the NPC is R15.
Perhaps trying to remove the looped statement and the priority statement because if you have an emote and you play for example the hype dance, it will already be looped and probably priority high
Eh, I’m kinda late on this but I guess I found the solution. Since the animation is from roblox, I’m not really sure if you could play it but here’s what I did:
1 - Download the animation file, paste this in your browser: http://www.roblox.com/Asset?ID=EMOTEID. It’ll download a file, rename it using “.rbxm” at the end of it.
2 - Import the animation to your roblox studio, then you may use one script to play it, this one is the looped version:
local Animation = script:WaitForChild("Fashionable")
local Humanoid = script.Parent:WaitForChild("Humanoid")
local AnimTrack = nil
if Humanoid ~= nil then
AnimTrack = Humanoid:LoadAnimation(Animation)
print("Animation loaded on NPC (" .. script.Parent.Name .. "). Animation = " .. Animation.Name .. ".")
else
print("Cannot load animation " .. Animation.Name .. " because the current Humanoid is nil. NPC = " .. script.Parent.Name .. ".")
return
end
spawn(function()
while wait() do
if Humanoid ~= nil and AnimTrack ~= nil and not AnimTrack.IsPlaying then
AnimTrack:Play()
end
end
end)