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

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

Asked by 3 years ago
Edited 3 years 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
0
Answered by 3 years ago
local Intro = "rbxassetid://"
local Cycle = "rbxassetid://"
local Outro = "rbxassetid://"
local cycle = false

script.Parent.MouseButton1Click:Connect(function()
    if cycle == false then
    cycle = true
    local Player = game.Players.LocalPlayer
    local Track = Player.Humanoid:LoadAnimation(Intro)
    Track:Play()
    wait(2)

    local Track2 = Player.Humanoid:LoadAnimation(Cycle)
    Track2:Play()
    end


0
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 — 3y
0
That's because it should be a local script... Insert the LocalScript in the button. BirthWormSaiiy 48 — 2y
0
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 — 2y
0
Just put an end at the end. BirthWormSaiiy 48 — 2y
0
i did now i get: "Humanoid is not a valid member of Player "Players.AlphaRedAnt"" AlphaRedAnt -4 — 2y
Ad

Answer this question