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

How do you clone a GUI into the playersGui?

Im trying to make an information booth for my zoo game but I keep running into the same error. I have a GUI inside a model with a surfaceGui.

script.Parent.screen.SurfaceGui.TextButton.MouseButton1Click:Connect(function(player)
	if not player:FindFirstChild("PlayerGui"):FindFirstChild("ElephantGUIC") then
		local clonedGui = script.Parent.ElephantGUI:Clone()
		clonedGui.Name = "ElephantGUIC"
		clonedGui.Parent = player:FindFirstChild("PlayerGui")
	end
end)

http://gyazo.com/00a7233792a5ce1814595513e29f061f

1 comment

0

What error are you running into?

1 answer

✓ Accepted answer

Start off the local script in StarterGui like this:

local c = ModelNameHere
c.screen.SurfaceGui.TextButton.MouseButton1Click:Connect(function()
    local player= game.Players.LocalPlayer
end)

Then work out the rest yourself as this is a helping site.

2 comments

0

Its in a script inside Workspace. Im confused.

0

No, put it all in a LOCAL SCRIPT IN STARTER GUI. (I made it caps so you could see it more clearly :))

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