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

Why won't it Clone() to PlayerGui?

I'm lost on how I clone a GUI from ReplicatedStorage into the PlayerGui which is moved to Team "Special Players". I've been testing, but I couldn't find the reason. Any help?

local special = game.Teams:findFirstChild("Special Players")

function onEntered(player)
	if checkOkToLetIn(player.Name) then
		player.TeamColor = special.TeamColor
		game.ReplicatedStorage.GreetingScreen:Clone().Parent = player.PlayerGui
	end
end

1 answer

✓ Accepted answer
local special = game.Teams:findFirstChild("Special Players")

game.Players.PlayerAdded:connect(function(player)
    if checkOkToLetIn(player.Name) then
        player.TeamColor = special.TeamColor
        game.ReplicatedStorage.GreetingScreen:Clone().Parent = player:WaitForDataReady("PlayerGui")
    end
end)

This should work, you should use WaitForDataReady() Because you don't want the script load before the PlayerGui exists.

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