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

Whats wrong with this GUI cloning script?

I've never worked with :clone() before. Unsurprisingly this script below doesn't work. Does anyone know why that is?

game.ReplicatedStorage.StartGUI = startGUI

game.Players.PlayerAdded:connect(function(player)
	local startGUICopy = startGUI:Clone()
	startGUICopy.Parent = player.PlayerGUI
end)

1 answer

You're problem is simple and easy to fix. Line 1 is backwards.

You put:

game.ReplicatedStorage.StartGUI = startGUI

However, it should be:

startGUI = game.ReplicatedStorage.StartGUI 

I would also recommend using local variables whenever possible, as they are more efficient. So,

local startGUI = game.ReplicatedStorage.StartGUI

Hope i helped!

2 comments

0

You're totally right, but it still doesn't function.

0

Are you testing it on PlaySolo? PlayerAdded events don't fire in PlaySolo. Start a server instead.

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