#stop animation

27 messages · Page 1 of 1 (latest)

silk prawnBOT
#

studio** You are now Level 3! **studio

eager stream
#

animation will not stop playing and keeps on looping

#
    local character = player.Character
    local humanoid = character:WaitForChild("Humanoid")
    local animation = Instance.new("Animation")
    animation.AnimationId = script.handsAction.AnimationId
    local animation1 = Instance.new("Animation")
    animation1.AnimationId = script.handsAction.handsLoop.AnimationId
    local track = humanoid:LoadAnimation(animation)
    local track1 = humanoid:LoadAnimation(animation1)
    
    local wait0 = track.Length
    
    if player.handsVar.Value == false then

        player.handsVar.Value = true

        track:Play()
        task.wait(wait0)
        track1.Looped = true
        track1:Play()
    else
        track.Looped = false
        track1.Looped = false
        track1:Stop()
        track:Play()
        player.handsVar.Value = false
    end
end)
#

@rapid raft

#

pinged random scripter sorry for ping

#

but I would think this would have a simple fix

#

not very familier with anim

rapid raft
#

setting looped via script does not work you have to set it in the animation itself in the editor.

eager stream
#

That’s how I exported it

#

But when I call the function when the variable is true it just plays the first animation (track) then keeps looping the 2nd animation (track1)

rapid raft
#

a couple things. animations shouldn't be played on the server, period. You can't load the animation over and over and cancel the last one it doesn't work that way you're creating a new animtrack object each time.

eager stream
#

I should do this on a local script then?

#

Then it will only be client sided then

#

Unless animations are always server sided

eager stream
rapid raft
#

that won't work

#

with multiple players in the game

#

but that is part of the solution for a localscript

#

@eager stream

eager stream
#

This is in serverscript

eager stream
#

Unless ur tryna tell me to use parameters

rapid raft
#

Animations aren't server sided anyways client has network ownership of animations