Log in to vote

how do i make a toggable animation button? im not a good scripter so please please help me.

Asked by 11 months ago
Edited 11 months ago

so i'm currently working on a game and i am good at animation but i need to know how to do this properly.

so i got 3 animations Sit(Intro, Not Looped And Pretty Much Sitting Down And Then Plays The Cycle.) Sit(Cycle Or Loop, Then When Player Clicks The Button Again it Plays The 3rd Animation) Sit(Outro, Not Loopeed Getting Up.)

so what i need help with is with a toggable button. pretty much i want a button that plays the intro when clicked and then plays the cycle animation and then when the player clicked it again it plays the outro.

again i suck at scripts all i really know how to do is make doors, proximity prompts that makes the player sit. and other crappy things. so if anyone can PLEASE help me :)

1 answer

Log in to vote
Answered by 11 months ago
local Intro = "rbxassetid://"
local Cycle = "rbxassetid://"
local Outro = "rbxassetid://"
local cycle = false

    if cycle == false then
    cycle = true
    local Player = game.Players.LocalPlayer
    local Track = Player.Humanoid:LoadAnimation(Intro)

    local Track2 = Player.Humanoid:LoadAnimation(Cycle)

i have tried local script and just the normal script and the normal script shows: Players.AlphaRedAnt.PlayerGui.ScreenGui.TextButton.Script:10: attempt to index nil with 'Humanoid' and the local shows Humanoid is not a valid member of Player "Players.AlphaRedAnt" AlphaRedAnt -4 — 11mo
That's because it should be a local script... Insert the LocalScript in the button. BirthWormSaiiy 48 — 11mo
okay it is a local script but i get this: Players.AlphaRedAnt.PlayerGui.ScreenGui.TextButton.LocalScript:18: Expected 'end' (to close 'function' at line 6), got <eof>; did you forget to close 'then' at line 7? AlphaRedAnt -4 — 11mo
Just put an end at the end. BirthWormSaiiy 48 — 11mo
i did now i get: "Humanoid is not a valid member of Player "Players.AlphaRedAnt"" AlphaRedAnt -4 — 11mo

Answer this question