I made a Hands Up animation which makes your walk speed set to 10 when it’s playing. BUT I also made a slow walk script where if you press the keycode again it will set your speed to 16 EVEN WHEN THE HANDS UP ANIMIATION IS STILL PLAYING. How can I make it where the slow script won’t work if the hands up animation is active?
Hands Up Animation:
Humanoid = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
local HandsUpAnimation = game.Workspace.Animations.HandsUp
local HandsUpAnimationButton = script.Parent.HandsUp
local LoadAnimation = Humanoid:LoadAnimation(HandsUpAnimation)
HandsUpAnimationButton.MouseButton1Click:Connect(function()
if not LoadAnimation.IsPlaying then
LoadAnimation:Play()
Humanoid.WalkSpeed = 10
else
LoadAnimation:Stop()
Humanoid.WalkSpeed = 16
end
end)
Slow Walk Speed:
UserInputService.InputBegan:Connect(function(SlowCharacterSpeed, gameProcessed)
if SlowCharacterSpeed.KeyCode == Enum.KeyCode.Z and not gameProcessed then
if SlowDownEffect == false then
SlowDownEffect = true
Humanoid.WalkSpeed = 10
else
SlowDownEffect = false
Humanoid.WalkSpeed = 16
end
end
end)
use multiplication and division (or addition and subtraction) instead of setting the variables (if you want the slow script to work when hands up)
if you dont, just add a boolean for wether or not handsup is playing, and just put it in a if statement for the slow walk speed script (unless they aint the same script? then just put a boolean value inside the player character instead)
local AnimationPlaying = Instance.new("BoolValue")
AnimationPlaying.Parent = game.Players
HandsUpAnimationButton.MouseButton1Click:Connect(function()
if not LoadAnimation.IsPlaying then
AnimationPlaying.Value = true
LoadAnimation:Play()
Humanoid.WalkSpeed = 10
else
like this? and then in the walk speed script I do something like “if AnimationPlaying.Value == true then” somethin like that?? ALSO WHAT WOULD I PUT AFTER THE “==true then” what would be after then???
Animation track objects already have an ‘IsPlaying’ property, you can use that to determine if an animation is playing or not (you don’t need a ‘BoolValue’ object).