I've been building a GUI for a good number of hours now, which has several buttons to open up different menus to allow for movement among the GUI. It works well and dandy, except for one issue: the first button in the GUI doesn't work in online servers, despite working in Studio. The entirety of the local script is below.
-- Definitions. Closed=true local gui = script.Parent:WaitForChild("SpecificFrame") GUI=script.Parent.Parent.SpecificFrame -- Text button function. function onClicked() if Closed then GUI:TweenPosition(UDim2.new(0, 110, 0, 3), "Out", "Quint", 1.5) Closed=false else GUI:TweenPosition(UDim2.new(0, -1000, 0, 3), "In", "Back", 1.5) Closed=true end end script.Parent.MouseButton1Down:connect(onClicked)
As I've stated before, the GUI works perfectly in the Studio client, and before adding in line 3, the error message "SpecificFrame is not a valid member of Frame" would appear exclusively in an online server; however, upon entering an online server, despite no error message occurring, the frame refuses to come into view. Any ideas as to what's going on?
-- UPDATE: Turns out it fails to open in test servers on Studio as well.
Well, you'd wanna to do the same as what you did on line 03, import a :WaitForChild()
method on line 04.
The reason this occurs is because, sometimes a element will not officially load, thus causing the code syntax to cast an error. This normally occurs to FE code.
Closed = true local gui = script.Parent:WaitForChild("SpecificFrame") local gui2 =script.Parent.Parent:WaitForChild("SpecificFrame") function onClicked() if Closed then gui2:TweenPosition(UDim2.new(0, 110, 0, 3), "Out", "Quint", 1.5) Closed = false else gui2:TweenPosition(UDim2.new(0, -1000, 0, 3), "In", "Back", 1.5) Closed = true end end script.Parent.MouseButton1Down:connect(onClicked)