Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Whats wrong with this GUI cloning script?

Asked by
RSoMKC 45
10 years ago

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

Log in to vote
0
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
10 years ago

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!

0
You're totally right, but it still doesn't function. RSoMKC 45 — 10y
0
Are you testing it on PlaySolo? PlayerAdded events don't fire in PlaySolo. Start a server instead. Perci1 4988 — 10y
Ad

Answer this question