Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to take out a default animation?

Asked by 6 years ago

Hello, i am making a game where these key shortcuts use animations, but they get interupted by the default idle animation, i tried, i cant do it, i want to take it out so it doesnt inturrupt my animations like it sometimes does. Actually, i have tried when the key is pressed then it takes out the animate sccript in character and puts back in after animstion finished, but it SOMEHOW STILL DID THE IDLE THING WHERE ARMS MOVE FORWARD A LITTLE AND BACK! Please help! thanks :) Iv tried

01can = true
02 
03script.Parent.Parent.Chatted:Connect(function(msg)
04    if msg == "KAMEHAMEHA" then
05if can == true then
06    can = false
07        script.Parent.Parent.Character.Humanoid.WalkSpeed = 0
08        script.Parent.Parent.Character.Humanoid.JumpPower = 0
09        local k = Instance.new("Animation")
10k.AnimationId = "rbxassetid://2863412692"
11wait()
12        script.Parent.Parent.Character.Humanoid:LoadAnimation(k):Play()
13        wait(5)--the time of animation
14script.Parent.Parent.Character.Humanoid.WalkSpeed = 16
15script.Parent.Parent.Character.Humanoid.JumpPower = 50
16wait(10)
17can = true
18    end
19    end
20end)

So this all works, its just that sometimes when the animation plays, then the idle animation with slightly moving arms interups! halp plesss!

2 answers

Log in to vote
1
Answered by
Tizzel40 243 Moderation Voter
6 years ago

Im not to sure what you are coming at in this question, but I will still try to make a solution out of it!

usally to stop all animations it would be like this!

1local humanoid = --- put you humanoid Here!
2 
3for I,AnimTrack in pairs(humanoid:GetPlayingAnimationTracks()) do---get all the playing animation tracks!
4 
5 
6AnimTrack:Stop()
7 
8end

that's an example of stop all tracks!

0
but isnt that to stop them? Bro, it keeps happening, if u notice, i keeps doing that default animation thing where hands move then stop.. then again, wouldnt this just stop the current one? eh whatever ill try this anyways, i just tried and i was right, it stops the CURRENT tracks playing, but then right before the other animation plays sometimes the hand thing happens again, so this is half solve CommanderCaubunsia 126 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

Hello, so as Tizzel40 said about the script, that stops tracks playing, as you said sir, they stop the current ones and that DOES happen. So think, is you dont want it, can oyu make a script that detects a track starting to play? just do it with the specific track, or if not, constantly stop all tracks until all of what your script does is over :) hope this helps!

Detect

01repeat wait() until
02animation.Playing maybe if that exists do
03local humanoid = --- put you humanoid Here!
04 
05for I,AnimTrack in pairs(humanoid:GetPlayingAnimationTracks()) do---get all the playing animation tracks!
06 
07 
08AnimTrack:Stop()
09 
10end

constant stop

01if bla bla
02if sbsf bla
03then do this
04humanoid = script.Parent.Humanoid
05 
06for I,AnimTrack in pairs(humanoid:GetPlayingAnimationTracks()) do---get all the playing animation tracks!
07 
08 
09AnimTrack:Stop()
10 
11end
12other animation
13local humanoid = --- put you humanoid Here!
14 
15for I,AnimTrack in pairs(humanoid:GetPlayingAnimationTracks()) do---get all the playing animation tracks!
16 
17 
18AnimTrack:Stop()
19 
20end

or set an actual number variable and make it true when script starts and make other script that detects when its true and constantly stops tracks, easy to do:

01while (value)== true do
02local humanoid = --- put you humanoid Here!
03 
04for I,AnimTrack in pairs(humanoid:GetPlayingAnimationTracks()) do---get all the playing animation tracks!
05 
06 
07AnimTrack:Stop()
08 
09end
10    end
0
add a wait in the last script or it will crash server because since no waits in basicly does infinite of this script at once! idunnobut 27 — 6y

Answer this question