Animation won't play, activated from GUI

Hi! I’m having a bit of trouble with my script, when you click the button, the dance is meant to play, but it doesn’t. I used the roundify feature, in a plugin, but I tried without it and it still didn’t work. I’m really new to scripting, so I may have made a rookie error :sweat_smile:

Thank you :smile:

local humanoid = game.Players.LocalPlayer:FindFirstChild("Humanoid")
local dance = humanoid:LoadAnimation(script:FindFirstChild("Animation"))

script.Parent.MouseButton1Click:Connect(function()
    dance:Play()
end)

I am so stupid, I didn’t make it in a local script, I’ll try that. (EDIT: It still doesn’t work :pensive:)

local humanoid = game.Players.LocalPlayer:FindFirstChild(“Humanoid”) this is the error , You gotta index the Character First

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:FindFirstChild('Humanoid')

local dance = Humanoid:LoadAnimation(script:FindFirstChild("Animation"))

script.Parent.MouseButton1Click:Connect(function()
 dance:Play()
end)

Also Make sure that its a Local Script

1 Like

Did it work ? @Rainnbow_skies . Im curious whether it worked