Issue with making a Gui appear after tween

When I tried adding a function to make a Gui appear AFTER the other Gui Tweened down to the lowest size, it would not appear.

Instead, a green bar comes up at the top of the screen.

The Gui elements that I added Visible = true to are indeed Visible. They just don’t show up at all.

Here is the script.

local function finishApplication()
	print("Application finished!")
	game.ReplicatedStorage.FinishApplicationEvent:FireServer(Questions, UserAnswers)
	wait(1)
	TopText.Text = game.Lighting.FinishText.Value
	MainFrame:TweenSize(ZeroSize, nil, nil, 0.3)
	print("Finished Tween")
	wait(0.1)
	game.StarterGui.SuggestionGUI.SuggestionFrame.SubmitButton.Visible = true
	game.StarterGui.SuggestionGUI.SuggestionFrame.Background.Visible = true
end

Apologies if I did not add enough information about my issue.

Issues with your script:

  1. you can’t use game.StarterGui when trying to change GUIs on the screen. Basically, the “StarterGui” is where GUIs are stored before a player enters the game. Once the player enters the game, the GUIs that they see on the screen are duplicated from StarterGui and put into “PlayerGui” (located inside of the player). Everything that the player sees is going to be in the PlayerGui, therefore all changes to Guis must be made there. The easiest way to do this is to just insert local scripts into the GUI itself so that you can locate it with script.Parent (or stuff like that).
MainFrame:TweenSize(ZeroSize, nil, nil, 0.3)
print("Finished Tween")

That will not do what you want it to do: the script isn’t going to wait for the tween to finish-- it just keeps running. To add a function at the end of the tween, make the final argument of :TweenSize a “callback” function which will automatically run when the tween stops.

Thanks so much! So, this is a ServerScript. So I can’t do Script.Parent functions with it. Should I put the Gui inside of the ServerScript and do game.ServerScriptService.FinishApplication.(Gui name).Visible = true?

Also, how would I call the Callback function? (Apologies, I’m kind of a noob at scripting)

MainFrame:TweenSize(ZeroSize, nil, nil, 0.3, finishApplication())

It’s the last value in your Tween.

I tried that, but now it doesn’t tween off anymore. It just stays on screen.

Sounds to me like there are a whole bunch of problems with your script now–
You said it’s a server script, but there’s hardly ever a reason for there to be a GUI being handled with a server script. Also, you said “FireServer” in that script-- you can’t do that with a server script. Start the script over. You should make it a LocalScript inside of the Gui (even though you CAN do it with a server script nonetheless) and then :TweenSize() on the GUI that the player sees-- not something in the StarterGui.

1 Like

Alrighty, I’ll try it.


But I want the tween to happen after completing the quiz. Should I do the FireClient when the quiz is over and then fire the localscript? (This will probably not work)

Thought I’d point out that this is not true, I currently have 5 Server Scripts running perfectly with

script.Parent

In all of them.

Wow, awesome! The script is currently in ServerScriptService, though. Not sure if I can move it out of there.

I believe you can by doing something like

script.Parent = workspace.SomeObjectThatYouWantItInsideOf

(obviously replacing workspace.SomeObjectThatYouWantItInsideOf with the thing you want it to be inside of)

Okay, I edited the script so now It’s a LocalScript inside of the Gui that is being tweened. It works fine.

That is a very vague question which I, of course, cannot answer since I have no idea what your script is for, nor did you even send the full script. The only 2 things that I am here to point out to you are that:

  1. You cannot make changes to a player’s GUIs through game.StarterGui
  2. Tweens do not make the script wait for the tween to finish before continuing.

Alright. Thanks for the help.