You could make a Boolvalue that inserts into the player like this (Make this a LocalScript and then put it in StarterPack also put a BoolValue into the local script and name it whatever, i named it active as seen in the example below:
local player = game.Players.LocalPlayer
while wait(1)do
if script.Active.Value == false then
script.Active.Value = true
local f = Instance.new("BoolValue")
f.Name = "AnimActive"
f.Value = false
f.Parent = player.Character
wait(.1)
end
end
Then you want to do this:
function onChatted(message, player)
if message == "/e sit" and player.Character.AnimActive.Value == false then
player.Character.AnimActive.Value = true
local character = game.Workspace[player.Name]
animTrack = character.Humanoid:LoadAnimation(animation)
animTrack:Play()
wait(.3)
player.Character.AnimActive.Value = false
end
end
You can make it go to false after playing the anim OR make a different script for when the player jumps it will go to false.
The AnimActive insert bool value script will reset when player dies so dont worry about that
Do this for every anim script and they wont run unless that anim active value = false
To do the player jump makes the anim active value false do this copy the insert anim active value script rename it and replace the code inside with this code V:
local player = game.Players.LocalPlayer
local x1 = player.Character:WaitForChild("AnimActive")
while wait(.00000001)do
if script.Active.Value == false and x1.Value == true and player.Character.Humanoid.Jump == true then
x1.Value = false
wait()
end
end
This will detect if player has jumped or not and disable the value if they have
then you can play a new animation if its false. Hope this helps, Kyu.
4 comments
How do i stop a certain animation track though
@Cmonlol135 All you would have to do is find the name that you named the Animation and just add this in: if v.Name =='ANIMATIONNAME' then v:Stop()
Does this work anymore? And if it does how do I make the button cancel ALL of the animations?
it still works and to make a butt just put lines 3 to 5 in a script.Parent.MouseButton1Click:connect(function()