I am trying to get the Shop (ScreenGui) with a LocalScript from the PlayerScript.
and this what I get like error
You need to use WaitForChild as it is not guaranteed that all instances is loaded when the localscript is ran.
I tried to put WaitForChild before but it cant find it so it is waiting to find it
Can you provide a code snippet? The WaitForChild should be called on PlayerGui with the correct name.
Are you sure that is the right script? WaitForChild shouldn’t error.
no wait itsnt the script that error before, I just add a WaitForChild to it
edit: even with a WaitForChild its doing nothing, it is waiting to find the Shop
That is the intended purpose, it will wait until the Shop gui is loaded.
yes I know, but even if its load he is still waiting for, like it cant detected the ScreenGui
Please provide an updated code snippet and the problem.
Is the PrimaryMainFrame inside the shop GUI?
Try adding the timeout function for WaitForChild(Instance, Timeout)
as sometimes if you lag the function times out and doesn’t end up finding the instance you need.
game:GetService("Players").LocalPlayer.PlayerGui:WaitForChild("Shop", 10)