So I’m trying to make a starting screen/loading screen that basically just drops down when the start button gets clicked, but it inevitably results in “attempt to index nil with ‘TweenPosition’”
This is the feedback that I received
This is the organization of the scripts and GUI’s
Does anybody know what this means or how to fix it?
local screen = script.Parent.screen
local playbutton = screen.ImageButton
local function End()
Screen.Visible = false
Screen:TweenPosition(UDim2.new(0, 0,1, 0),"Out", "Quad", 0.5, false, End)
print ("step 2")
December 31, 2020, 5:00am
TweenPosition is only a function for GUIS like Frame,TextLabel,TextButton,TextBox,etc. Screenguis are only holders for these guis.
Whatever you used to define Screen is nil.
so i need to change my variable?
Yes, you would have to change the
value of the variable.
sorry im new to scripting
what does that mean
I’ll give a quick example:
local screen = guiObject.Frame.TextLabel
-- Variable Name Variable Value
In your situation, the value of Screen does not exist in the hierarchy.
so the variable value is what the variable name represents?
You define the local variable “screen”, but then attempt to tween “Screen”. I’ve had this cause an issue for me before when I was newer to scripting, just be careful because local variables are case-sensitive. If this isn’t the issue then sadly I don’t know what else is causing the issue.