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

Cloning GUI for specific players problem?

For specific players I want them to have a GUI that is set in my Lighting and have it cloned to them. However I get no errors and the following admins don't see the GUI, whats the problem here?

local admins = {"Pancakechop", "WaffleWhop"}

local player = game.Players.LocalPlayer
while not player.Character do
    wait()
end
local character = player.Character

if player.Name == (admins) then
	
	o = game.Lighting.Obby1
	ob = game.Lighting.Obby1:Clone()
	ob.Parent = player.PlayerGui

	if character.Health == 0 then
		wait(5)
		o:Clone()
		o.Parent = player.PlayerGui
	end
end

1 answer

✓ Accepted answer

First of all Lighting isn't for storage, put whatever is there into ReplicatedStorage. Second, if the game is FE, the client will not have access to the contents of Lighting, which is another reason its stored contents should be in ReplicatedStorage.

The actual problem here is that you're asking if player.Name==admins which is not true; a string is not equal to a table. What you should do alternatively is write the table differently: local admins={["Pancakechop"]=true,["WaffleWhop"]=true} and check to see if a player is in the table by if admins[player.Name]then

1 comment

0

You should also make sure it isn't case-sensitive, and if you're worried enough, use userIds to be safe from username changes too.

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