so i made a textbutton that when i click at it, it does the animation

local player = game:GetService("Players").LocalPlayer
local character = player.Character
if not character then
	character = player.CharacterAdded:Wait()
end

local humanoid = character:WaitForChild("Humanoid")
local button = script.Parent

local animationid = 'rbxassetid://491426316' 

local animation = Instance.new("Animation")
animation.Parent = character
animation.AnimationId = animationid
local LoadAnimation = humanoid:LoadAnimation(animation)

button.MouseButton1Click:Connect(function()
    print("lol")
    LoadAnimation:Play()
end)

i've tested if the humanoid is not nil and it isnt and also tested if the event really works with printing "lol" and it does print it.

4 comments

0

also its a local script

0

Is this in your own game?

0

no, its in a group

0

also there are no errors