Either because you didn’t parent the Animation
Or your animation have problem with priority
if not idk:/
(Also i think this post should be scripting support not code review)
Ill edit the title to be scripting support but how could I Parent an Animation?
also the game and animation are mine to answer @Jando_123456’s question
Start the debugging process and see what It prints:
local Bell = workspace.bellmodel.Bell.bellhitbox
local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://14503813709"
Bell.ClickDetector.MouseClick:Connect(function(player)
print("Bell clicked by", player.Name)
local Character = player.Character
if Character then
print("Character found")
local Humanoid = Character:WaitForChild("Humanoid")
if Humanoid then
print("Humanoid found")
local Track = Humanoid.Animator:LoadAnimation(Animation)
Track:Play()
print("Animation played")
else
warn("Humanoid not found in character")
end
else
warn("Character not found for player")
end
end)
-- inside function script
local Character = player.Character
local Humanoid = player:FindFirstChild("Humanoid")
local Animation = -- bla bla bla
Animation.Parent = -- the part or character
if Humanoid then
local Track = Humanoid:LoadAnimation(Animation)
Track:Play()
end