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 make the GUI clone into the PlayerGui?

The script here that is pretty rough that I only just made doesn't work and I need help fixing it. It seemed simple to me when I first made it, but now it is an absolute headache to work with. Its for a morph I am making, and I want it so when the button is clicked, the GUI also gets cloned into the PlayerGui so only the player can view it. Any help is greatly appreciated!

local debounce = false

function onClicked(mouse)
	if debounce == false then
		debounce = true
		script.Parent:FindFirstChild("FlashGUI"):Clone().Parent = game.Players.LocalPlayer.PlayerGui
		wait(5)
		debounce = false
	end
end


script.Parent.ClickDetector.MouseClick:Connect(onClicked)

1 answer

✓ Accepted answer

The clickdetector.MouseClick event has the PlayerThatClicked as its argument, not the mouse. Simply use a server-script to clone the ui into the player's playergui, or have the gui already in the players' playergui and tell them to enable it with a remote event.

In my opinion There's no point cloning the gui into the client if the client has to do the work, simply enabling it will do just as good. (.Enabled is a property directly of a screenGu.i)

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