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 4 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.

1local sf = script.Parent.Parent.ScrollingFrame
2 
3script.Parent.MouseButton1Click:Connect(function()
4    sf.Visible = not sf.Visible
5end)

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:

01local player = game.Players.LocalPlayer
02local character = player.Character
03repeat wait()
04    character = player.Character
05until character
06local hum = character:WaitForChild("Humanoid")
07local emote = hum:LoadAnimation(script.Parent.Animation)
08playing = false
09 
10script.Parent.MouseButton1Click:connect(function()
11    if playing == false then
12        emote:Play()
13        playing = true
14    elseif playing == true then
15        emote:Stop()
16        playing = false
17    end
18end)

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 — 4y
0
I think it just works the same way to hide the gui xXLegendGamerz16Xx 231 — 4y
0
it works the same... NOLIFE_DEV 25 — 4y

Answer this question