local Sit = script.Parent
local Animation = Sit:WaitForChild("Sit2")
local OtherAnim = script.Parent.Parent.Sit:WaitForChild("SIt1TempB")
local Temp = false
local Humanoid = game.Players.LocalPlayer.Character:FindFirstChild("Humanoid")
local Animator = Humanoid:FindFirstChild("Animator")
local AnimationTrack = Animator:LoadAnimation(Animation)
local AnimationTrack2 = Animator:LoadAnimation(OtherAnim)
Sit.MouseButton1Click:Connect(function()
if AnimationTrack2.IsPlaying then
AnimationTrack2:Stop()
end
if Temp == false then
Temp = true
AnimationTrack:Play()
elseif Temp == true then
Temp = false
AnimationTrack:Stop()
end
end)
I made a script that plays an animation when you click GUI, and stops when you click it again. That works, the problem is people can play both animations at once,
which is something I don’t want. I’m trying to make it so if one animation is playing, the other stops playing. I’m stumped on how to fix it and need abit of help