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 5 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

can = true

script.Parent.Parent.Chatted:Connect(function(msg)
    if msg == "KAMEHAMEHA" then
if can == true then
    can = false
        script.Parent.Parent.Character.Humanoid.WalkSpeed = 0
        script.Parent.Parent.Character.Humanoid.JumpPower = 0
        local k = Instance.new("Animation")
k.AnimationId = "rbxassetid://2863412692"
wait()
        script.Parent.Parent.Character.Humanoid:LoadAnimation(k):Play()
        wait(5)--the time of animation
script.Parent.Parent.Character.Humanoid.WalkSpeed = 16
script.Parent.Parent.Character.Humanoid.JumpPower = 50
wait(10)
can = true
    end
    end
end)

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
5 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!


local humanoid = --- put you humanoid Here! for I,AnimTrack in pairs(humanoid:GetPlayingAnimationTracks()) do---get all the playing animation tracks! AnimTrack:Stop() end

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 — 5y
Ad
Log in to vote
0
Answered by 5 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

repeat wait() until
animation.Playing maybe if that exists do
local humanoid = --- put you humanoid Here!

for I,AnimTrack in pairs(humanoid:GetPlayingAnimationTracks()) do---get all the playing animation tracks!


AnimTrack:Stop()

end

constant stop

if bla bla
if sbsf bla
then do this
humanoid = script.Parent.Humanoid

for I,AnimTrack in pairs(humanoid:GetPlayingAnimationTracks()) do---get all the playing animation tracks!


AnimTrack:Stop()

end
other animation
local humanoid = --- put you humanoid Here!

for I,AnimTrack in pairs(humanoid:GetPlayingAnimationTracks()) do---get all the playing animation tracks!


AnimTrack:Stop()

end



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:

while (value)== true do
local humanoid = --- put you humanoid Here!

for I,AnimTrack in pairs(humanoid:GetPlayingAnimationTracks()) do---get all the playing animation tracks!


AnimTrack:Stop()

end
    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 — 5y

Answer this question