Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How does this error even make sense?

Asked by 10 years ago

The error in the output makes absolutely no sense to me. Does anyone mind explaining what's going wrong? Error + Explorer

0
Dunno. Maybe screem is not fully loaded when the script runs? You could try WaitForChild(). Perci1 4988 — 10y

1 answer

Log in to vote
3
Answered by
blocco 185
10 years ago

Error for those who didn't click the link: screem is not a valid member of PlayerGui

Most likely, your LocalScript is running before all of the PlayerGui has loaded. This means that your code will attempt to access screem before it exists, leading to that error. An awesome fix for this is the Instance:WaitForChild(string name) method.

For example, I will fix one of your lines:

from

previousbutton2 = script.Parent.Parent.screem.ImageButton2

to

previousbutton2 = script.Parent.Parent:WaitForChild("screem"):WaitForChild("ImageButton2")
0
Thanks. I never knew that WaitForChild could be chained like that. matto323 5 — 10y
Ad

Answer this question