Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

cant play an animation, any help?

Asked by
Ali_MTR 30
4 years ago

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.

0
also its a local script Ali_MTR 30 — 4y
0
Is this in your own game? cegberry 432 — 4y
0
no, its in a group Ali_MTR 30 — 4y
0
also there are no errors Ali_MTR 30 — 4y

Answer this question