ScreenGui Wont Clone to PlayerGui/ or parent to PlayerGui

I have a local script containing all my GUI info for a quest system.

What is supposed to happen is when you click the click detector the Gui clones to the playerGui so every player’s GUI displays different text for the quest.

My problem is the Gui won’t clone or parent to the players when the part is clicked.


local ClickDetector = script.Parent.ClickDetector

local QuestGui = game.Workspace.Bill.ClickPart.QuestGiverScript:WaitForChild("qgPartGui")


ClickDetector.MouseClick:Connect(function(clicker)
	
	local QuestGuiClone = QuestGui:Clone()
	QuestGuiClone.Parent = clicker.PlayerGui
	
	if QuestGuiClone.Enabled == false then
		QuestGuiClone.Enabled = true
	end

Where is the local script located, I don’ think its possible to get ClickDetector.MouseClick with local script.

Its located in Workspace < DummyModel < Part < local Script — the one we are talking about

All Gui must be in a ScreenGui. (game.Players.LocalPlayer.PlayerGui.ScreenGui)

I just checked myself, and clickdetectors can only be detected from serverscripts.

I don’t think that is true because it has worked when the code was in a server script. Also im kinda confused by All Gui must be in a ScreenGui. (game.Players.LocalPlayer.PlayerGui.ScreenGui). I know that im just trying to clone the ScreenGui to playerGui not whats in it

Oh I see. I also read a article on that but wasnt sure. Thanks


It’s possible the local script doesn’t have the player variable passed so OP would have to use
game.Players.LocalPlayer instead to get the player

Oh, so is GuestGuiClone a ScreenGui?

So click detectors can be used in local scripts? i mean it makes more sense because GUI should always be displayed on the client side

yeah I made a variable called local QuestGui to get the screen gui then another variable to clone it

Try ditching the clicker variable and make a different one

local Player = game.Players.LocalPlayer

I tested in game it still shows the local player as the clicker.
Might have something to do with your UI.

The argument clicker im passing is the same thing as Player. Also im not sure why i would do

local Player = game.Players.LocalPlayer when the argument I passed does that

I was thinking local scripts don’t pass it because the local player can only click it.

Your UI is a ScreenGui and has everything visible when enabled right?

your UI is a ScreenGui and has everything visible when enabled right?. Yeah only when its in Starter gui

If you add a print(“anything”) to the function when the clickdetector is clicked, does it print?
Whenever I try to use clickdetectors with a localscript nothing inside of it runs

When in play mode check in explorer if the GUI gets parented to the player PlayerGui in the explorer.

probably because your LocalScript is in the workspace.

Waiit.

Does the OP have the local script inside a local service?

Actually no it doesnt. How come :thinking:

LocalScripts need to be in local services like PlayerGui to run.
They don’t work in the Workspace.

1 Like