[FIXED] Player.PlayerGUI Error

Hello! I am having a problem with my button tweening script. I will leave as much possible information below.

I triple checked to make sure the local frameTrigger leads to the module. If you need more information, say so below. Thanks

Here is the local script

local frameTrigger = require(script.Parent.Parent.Parent.Parent.Parent.Parent.FrameTrigger)


script.Parent.MouseButton1Click:Connect(function()
	
frameTrigger.OpenFrame("RebirthFrame")

end)

print("Open")```

You probably want to add a WaitForChild just in case the script runs before the module is loaded.

I would recommend putting the modulescript in ReplicatedStorage, also add a :WaitForChild() in case the module script isnt loaded at first.

You should definitely use FindFirstAncestor or FindFirstAncestorWhichIsA or reference from PlayerGui instead of spamming Parents.

Where in the world is FrameTrigger located?

Also, when referring to a UI object, you have to use WaitForChild on the first ancestor. You don’t have to use WaitForChild for the rest of the descendants of that ancestor.

Also keep your localscripts within the StarterGui, or within the GuiObject you’re working on. Anything else is bad for organising. :slight_smile:

Thanks to everyone that helped!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.