#I can't stop the animation

150 messages · Page 1 of 1 (latest)

hallow cairn
#
local on = false
game.ReplicatedStorage.Actions.Sleep.OnServerEvent:Connect(function(plr) -- When event have been enable
    local anim = plr.Character.Actions -- Finding The Action Folder
    local char = plr.Character -- To know character
    local hum = char:WaitForChild("Humanoid") -- Find The Humanoid of character
    local track = hum:LoadAnimation(anim:FindFirstChild("Sleep")) -- Name of Action
        track.Looped = true

    if on == false then
        on = true
        track:Play() -- Play The Animtion
-- Nothing
    elseif on == true then
        on = false
        track:Stop()--Stops the animation
--end this script
    end
end)

i make it when press the button, Animation in character will play, When press button again then stop, but I don't know what is wrong with this script , The Play Does work, but the Stop animation is don't work , Maybe just watch the video, you will understand
I want someone to fix this, or tell me the problem, I would be so** thankful**

Also sorry if i have some grammar mistake or issue

willow cairnBOT
#

studio** You are now Level 2! **studio

hallow cairn
#

Please ping me when you answer me, I really need help with this, would really thankful if someone help me ❤️

unborn topaz
#

hm

#

I think this?

#

track.Looped = true

#
if on == false then
        on = true
        track:Play()
    else
track.Looped = false
on = false

track:Stop()
end
end)
#

@hallow cairn

unborn topaz
#

oops

#

I saw

hallow cairn
#

Wait lemme try make the sleep animation loop

unborn topaz
#

something

#

wait

#

@hallow cairn

#

why did u connect it

#

to a remote event?

#

there is no need for that

#

just use a

#

button

#

like Button.MouseClick

#

alr wait

hallow cairn
#

Well it don't work when i use it

#

😋

#

when i use the remote event it works

hallow cairn
unborn topaz
#

wait

#

@hallow cairn oops sry

#

I was busy

#

forgot to send

#

the script

hallow cairn
#

Oke

unborn topaz
#

aight here

#
local player = game.Players.LocalPlayer

local character = player.Character
local hum = character:WaitForChild("Humanoid")

local AnimationID = 000000000 -- ID here

local anim = Instance.new("Animation")
anim.Parent = script
anim.AnimationId = AnimationID

local track = hum:LoadAnimation(script.Animation)

IsPlaying = false

script.Parent.MouseButton1Click:connect(function()
    if IsPlaying == false then
        track:Play()
        IsPlaying = true
    elseif IsPlaying == true then
        track:Stop()
        IsPlaying = false
    end
end)
#

@hallow cairn

#

put the anim id

#

inside AnimationID

hallow cairn
#

Does other people can see the animation too?

unborn topaz
#

yes

#

make it a local script

hallow cairn
#

Oka i will try then\

#

Wait where should i put this at

#

button?

unborn topaz
#

wait

#

wait

#

copy the script again

unborn topaz
hallow cairn
unborn topaz
#

ye

#

forgot

#

to do sm

#

let me fix

#

it

#

wait

#

ok ye, it works

#

alr let me send

#

the script

#
local player = game.Players.LocalPlayer

local character = player.Character
local hum = character:WaitForChild("Humanoid")

local AnimationID = 15622241354

local anim = script.Animation
anim.AnimationId = "rbxassetid://"..AnimationID

local track = hum:LoadAnimation(script.Animation)

IsPlaying = false
track.Looped = true

script.Parent.MouseButton1Click:connect(function()
    if IsPlaying == false then
        track:Play()
        IsPlaying = true
    elseif IsPlaying == true then
        track:Stop()
        IsPlaying = false
    end
end)
#

@hallow cairn

hallow cairn
#

oki

willow cairnBOT
#

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

hallow cairn
#

lemme test

hallow cairn
#

I actually do like that before but it just never work
so i could use remote event

unborn topaz
#

it worked for me

#

hm

hallow cairn
#

I already changed the animation id too

unborn topaz
#

wait

#

your game is r6

#

or r15

hallow cairn
#

r6

unborn topaz
#

ok

#

now

#

that button

#

your sure its a textbutton?

hallow cairn
unborn topaz
#

hm

hallow cairn
#

it's a textbutton

unborn topaz
#

it should work

#

hm

#

@hallow cairn show me the output

hallow cairn
#

there no any telling in output

#

about the script

unborn topaz
#

maybe animation didnt load

hallow cairn
#

oh wait yes

unborn topaz
#

oh

#

i forgot to tell you

#

something

#

wait

#

@hallow cairn

#

click on the localscript

#

and add an "Animation"

#

inside it

#

and then test

#

the game

hallow cairn
#

Wdym add animation?

#

Oh

unborn topaz
#

this

hallow cairn
unborn topaz
#

yes

hallow cairn
#

output don't have error about this script anymore but it still don't work

unborn topaz
#

bruh how

#

u sure

#

you did it correct?

#

show me your studip

#

send the screenshot

#

of your studio

hallow cairn
unborn topaz
#

hm

#

let me test

#

real quick

#

bro

#

it works fine for me

#

@hallow cairn send me

#

your animation

#

ID

hallow cairn
#

if i sent, my id animation will not work with you anyway?

unborn topaz
#

just send

hallow cairn
#

15743561147

unborn topaz
#

I think I know the problem

#

@hallow cairn

#

yeah

#

this is why

#

Failed to load animation - sanitized ID: rbxassetid://15743561147 - Studio

unborn topaz
#

and then use the new ID

hallow cairn
#

😭

unborn topaz
#

just try it

#

it happens to me alot

#

even if its mine

hallow cairn
#

kk wait

unborn topaz
#

ok

#

the script works

#

but something is wrong with your animation

#

maybe it only works on roblox

#

or something

hallow cairn
#

Because of that\

#

so i use remote event

#

lol

unborn topaz
#

ok

#

do that

#

but

#

instead of button.mouseclick

#

just use a remote event

hallow cairn
#

yeah i fixing it again\

#

the script is so confusing imma fix