Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I enable my GUI through script and what did I mess up?

It's in LocalScript.

local part = script.Parent

part.Touched:Connect(function(yeet)

if (yeet.Parent and game.Players:FindFirstChild(yeet.Parent.Name)) then

game.StarterGui.GUIQuest.quest.Visible = true

game.StarterGui.GUIQuest.quest.roundify.Visible = true

end

end)

If I put print('') in it, it does print, but it doesn't show the GUI.

2 answers

✓ Accepted answer

I think your problem here is that you're trying to edit the GUI from StarterGui rather than PlayerGui. Don't worry, it's a common mistake :)

Try this instead:

local part = script.Parent

part.Touched:Connect(function(yeet)

	if (yeet.Parent and game.Players:FindFirstChild(yeet.Parent.Name)) then

		local plr = game.Players.LocalPlayer
		plr.PlayerGui.GUIQuest.Visible = true
		plr.PlayerGui.GUIQuest.roundify.Visible = true

	end

end)

If this still doesn't work, try doing this script but NOT in a localscript.

local part = script.Parent

part.Touched:Connect(function(yeet)

	if (yeet.Parent and game.Players:FindFirstChild(yeet.Parent.Name)) then

		local plr =  game.Players:FindFirstChild(yeet.Parent.Name)
		plr.PlayerGui.GUIQuest.Visible = true
		plr.PlayerGui.GUIQuest.roundify.Visible = true

	end

end)

Hope this helps!

part.Touched:Connect(function(yeet) 
	if (yeet.Parent and game.Players:FindFirstChild(yeet.Parent.Name)) then
		local player = game.Players:FindFirstChild(yeet.Parent.Name))
		player.PlayerGui.GUIQuest.quest.Visible = true
		player.PlayerGui.GUIQuest.quest.roundify.Visible = true 
	end 
end)

You are editing the StarterGui instead of the PlayerGui.

This discussion is preserved as it was. New answers, comments, and votes are closed.