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

Cloning GUI for specific players problem?

Asked by 9 years ago

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

Log in to vote
0
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
9 years ago

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

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. 1waffle1 2908 — 9y
Ad

Answer this question