Hi I've made a emote gui which it's very working but after I reset my character the emotes doesn't work anymore and it pops up this error and I haven't figure out how to fix it yet : " Loadanimation requires the humanoid object (player1.Humanoid) to be a descendant of the game object "
Here's my script
wait(1)
local user = game.Players.LocalPlayer
repeat
wait()
until user.Character
local Input = game:GetService("UserInputService")
local animen = script.Parent.Parent.Parent:WaitForChild("Dances")
local speeder, speedval = animen:WaitForChild("Speeddancehaha"), 1
local mouse = user:GetMouse()
local scrollingframe = script.Parent
local anim
local char = user.Character
local humanoid = char:WaitForChild("Humanoid")
local ftime = 0.7
function playanim(id, lola)
function setspeedval(num)
speedval = num
if anim then
anim:AdjustSpeed(num)
end
speeder.Bar.Size = UDim2.new(num / 2 * 3 - 1, 0, 1, 0)
end
speeder.MouseButton1Down:Connect(function()
while Input:IsMouseButtonPressed(Enum.UserInputType.MouseButton1) and game:GetService("RunService").RenderStepped:Wait() do
local absz, absp = speeder.AbsoluteSize, speeder.AbsolutePosition
local fact = math.min(1, math.max(0, (mouse.X - absp.X) / absz.X))
setspeedval((fact + 1) * 2 / 3)
end
end)
if char ~= nil and humanoid ~= nil then
local id = "rbxassetid://" .. tostring(id)
local oldanim = char:FindFirstChild("LocalAnimation")
if anim ~= nil then
anim:Stop(ftime / speedval)
end
if oldanim ~= nil then
if oldanim.AnimationId == id then
oldanim:Destroy()
return
end
oldanim:Destroy()
end
local animation = Instance.new("Animation", char)
animation.Name = "LocalAnimation"
animation.AnimationId = id
anim = humanoid:LoadAnimation(animation)
anim:Play(ftime / speedval)
if lola then
setspeedval(lola.Speed)
end
anim:AdjustSpeed(speedval)
function stopdance()
if not anim then
return
end
anim:Stop(ftime / speedval)
anim = nil
speeder.Bar.Size, speedval = UDim2.new(0.5, 0, 1, 0), 1
end
spawn(function()
while wait() do
local hum = char:FindFirstChild("Humanoid")
if hum and (hum.Sit or hum.MoveDirection.Magnitude > 0) then
pcall(stopdance)
end
end
end)
Please help me fix this annoying errors

7 comments
Still not working :(
Add some prints and see where it's not working
Oh my bad i forgot it's at line 46 - global playanim
Ye but thats a whole function with 40 lines it's not the actual problem
It's telling you thats theres an error in that function, add prints to find it
i couldn't find it, sorry :(
I would love to help you but without pinpointing the error I don't know where to start