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

Scripted so any textbutton pressed the player would do an animation, not working, help?

Asked by 3 years ago

I have a ScreenGui under StarterGui. In the ScreenGui I have a scrolling frame and a text button. The text button is a button that makes the scrolling frame visible if clicked and closes if pressed again.

local sf = script.Parent.Parent.ScrollingFrame

script.Parent.MouseButton1Click:Connect(function()
    sf.Visible = not sf.Visible
end)

The scrolling frame contains a UIListLayout and a bunch of text buttons named 'Emote'. In each of the emote, there is a local script and a Animation.

The animation for each button is different, I took a long time to put alot of rbxassetid://----- things in each of them. They are all avatar animations. My goal is to when the user clicks, they will start doing the animation. Everything worked perfectly but when I click it doesn't start doing the animation. Here is the local script:

local player = game.Players.LocalPlayer
local character = player.Character
repeat wait()
    character = player.Character
until character
local hum = character:WaitForChild("Humanoid")
local emote = hum:LoadAnimation(script.Parent.Animation)
playing = false

script.Parent.MouseButton1Click:connect(function()
    if playing == false then
        emote:Play()
        playing = true
    elseif playing == true then
        emote:Stop()
        playing = false
    end
end)

I was wondering if anyone can help me debug or help me.

0
sf.Visible = not sf.Visible is wrong. It should be sf.Visible = false NGC4637 602 — 3y
0
I think it just works the same way to hide the gui xXLegendGamerz16Xx 231 — 3y
0
it works the same... NOLIFE_DEV 25 — 3y

Answer this question