Today I was making a game where all you do is cry and I want to make a button that you can click and my animation will play. I’ve tried
local de = true
script.Parent.MouseButton1Click:Connect(function(player)
wait(3)
local Animation = player.Character.Humanoid:LoadAnimation(script.Parent.Cry)
if de == true then
de = false
Animation:Play()
end
wait(5)
de = true
end)
But it just keeps erroring Players.BMWLux.PlayerGui.ScreenGui.TextButton.LocalScript:4: attempt to index nil with 'Character'.
There is no parameter for MouseButton1Click, so you can’t get the player from it. Try the following:
local player = game.Players.LocalPlayer
local de = true
script.Parent.MouseButton1Click:Connect(function()
wait(3)
local Animation = player.Character.Humanoid:LoadAnimation(script.Parent.Cry)
if de == true then
de = false
Animation:Play()
end
wait(5)
de = true
end)
Never mind, I think what I told you was incorrect about using the Animation Id. What you had before I think was correct. So script.Parent.Cry is an “Animation”?