I also have 2 qestions one for the title and this: I have more then 1 animation do I just put the animation with the script in the gui?
local player = game.Players.LocalPlayer local char = player.Character or player.CharacterAdded:Wait() local hum = char.Humanoid local animation = hum:LoadAnimation(script.Animation) animation:Play()
I think the problem is that you used or
in a variable. You should use a repeat until
statement instead. Also, you will have to use the MouseButton1Click
event and connect it to a function so the animation plays when you click it, make sure the script is a LocalScript
, and make sure the gui instance is a TextButton
.
local player = game:GetService("Players").LocalPlayer repeat wait() until player.Character local char = player.Character local hum = char:WaitForChild("Humanoid") local animation = hum:LoadAnimation(script.Animation) script.Parent.MouseButton1Click:Connect(function() animation:Play() end)
And to answer your question, yes you should put the script with the animation inside the TextButton
.