Help with script

Whats wrong with my script?

local TreeNotePart = game.Workspace.Game.TreeNote
local TreeNoteGui = game.StarterGui.TreeNoteGui

TreeNotePart.ClickDetector.MouseClick:Connect(function()
	TreeNoteGui.Enabled = true
end)

All help appreciated! :grinning:

Hi, @Luxurious_Scripter Can you please tell me what this script is for?

So when I click a part, a gui appears

The problem is is that you are referencing the starter gui, not the player’s gui.
This should fix the problem:

local TreeNotePart = game.Workspace.Game.TreeNote

TreeNotePart.ClickDetector.MouseClick:Connect(function(plr)
	plr.PlayerGui.TreeNoteGui.Enabled = true
end)
1 Like

Look at this:

Thats because there is no part in workspace.Game called TreeNote, or the script loaded before TreeNote can load, so if thats whats happening then add this to the first line:

repeat wait(0.1) until workspace.Game:FindFirstChild("TreeNote")

This is our explorer:

I’m looking for typos but haven’t found any.

I found it! Change plr.PlayerGui to plr.StarterGui

But there isnt a child of a player called StarterGui.
Whats probably happening is the script loads before the TreeNote can load.

1 Like

You were right it didn’t load!