HandsUpAnimationButton.MouseButton1Click:Connect(function()
LoadAnimation:Play()
Humanoid.WalkSpeed = 10
end)
How can I make it if you press the button again the animation will stop?
HandsUpAnimationButton.MouseButton1Click:Connect(function()
LoadAnimation:Play()
Humanoid.WalkSpeed = 10
end)
How can I make it if you press the button again the animation will stop?
Try LoadAnimation:Stop()
This text will be blurred
I know but like how do I make it where if you press the button AGAIN
How about making a bool value and do something like
Button.MouseButton1Click:Connect(function()
Playing = not Playing
if Playing == true then
Animation:Play()
else
Animation:Stop()
end
end)
Question what does Playing = not Playing mean
It basically does
if Playing == true then
Playing = false
else
Playing = true
end
but with fewer characters
if value is true, set value to false and vice versa
Ok also question what’s the default Font, Font Style, Size for the script editor?
I have no idea but you could probably check studio settings and look for that
I did, but I accidently changed it. Could you log into studio and go to studio settings and tell me the Script Editor’s Font, Font Style, Size?
Sorry but I’m on my phone and I can’t really access studio right now
I will let you know when I get on my computer
Ok, I’ll try finding it out. (Addincharacter)
What should I do?
Add Playing = false
above HandsUpAnimationButton…function()
HandsUpAnimationButton.MouseButton1Click:Connect(function()
if Playing == true then
LoadAnimation:Play()
Humanoid.WalkSpeed = 10
else
LoadAnimation:Stop()
Humanoid.WalkSpeed = 16
end
end)
It worked, but when I pressed the button again it didn’t stop the animation.
you forgot to put Playing = not Playing
Oops didn’t come in my copy and paste
Humanoid = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
Playing = not Playing
local HandsUpAnimation = game.Workspace.Animations.HandsUp
local HandsUpAnimationButton = script.Parent.HandsUp
local LoadAnimation = Humanoid:LoadAnimation(HandsUpAnimation)
HandsUpAnimationButton.MouseButton1Click:Connect(function()
if Playing == true then
LoadAnimation:Play()
Humanoid.WalkSpeed = 10
else
LoadAnimation:Stop()
Humanoid.WalkSpeed = 16
end
end)
i think you’re supposed to put
playing = not playing
between the
HandsUpAnimationButton.MouseButton1Click:Connect(function()
and
if Playing == true then
but replace the current Playing = not Playing
with Playing = true
It didn’t work
Humanoid = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
Playing = true
local HandsUpAnimation = game.Workspace.Animations.HandsUp
local HandsUpAnimationButton = script.Parent.HandsUp
local LoadAnimation = Humanoid:LoadAnimation(HandsUpAnimation)
HandsUpAnimationButton.MouseButton1Click:Connect(function()
if Playing == true then
LoadAnimation:Play()
Humanoid.WalkSpeed = 10
else
LoadAnimation:Stop()
Humanoid.WalkSpeed = 16
end
end)
you forgot to add the playing = not playing
HandsUpAnimationButton.MouseButton1Click:Connect(function()
Playing = not Playing
if Playing == true then
There’s an error