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.

3 comments
sf.Visible = not sf.Visible is wrong. It should be sf.Visible = false
I think it just works the same way to hide the gui
it works the same...