skrank249
|
  |
| Joined: 03 Nov 2007 |
| Total Posts: 509 |
|
|
| 29 Jun 2013 09:18 PM |
How can I make a allowed Player List to copy a GUI to them?
allowed = {"Player1","RandomName"}
if allowed g = game.Lighting.cPanel g:clone g.Parent = game.Players."..Allowed..".PlayerGui end
eh, don't know what I even did xD |
|
|
| Report Abuse |
|
|
skrank249
|
  |
| Joined: 03 Nov 2007 |
| Total Posts: 509 |
|
| |
|
|
| 29 Jun 2013 09:27 PM |
Are you trying to create a gui or what, because I don't exactly know what you did either. I cannot guarantee that I will be able to tell you what you did wrong or fix it, I am just trying to help. |
|
|
| Report Abuse |
|
|
skrank249
|
  |
| Joined: 03 Nov 2007 |
| Total Posts: 509 |
|
|
| 29 Jun 2013 09:27 PM |
Yes it clones a GUI I have in lighting.
Then moves to the player if his name is the table. |
|
|
| Report Abuse |
|
|
|
| 29 Jun 2013 09:30 PM |
allowed = {"MassiveGman","Player1"}
game.Players.PlayerAdded:connect(function(pl) pl.CharacterAdded:connect(function(character)
for i,v in pairs(allowed) do if pl.Name == v then pl:WaitForChild("PlayerGui") local gui = script.GUI:Clone() gui.Parent = pl.PlayerGui end end
end) end)
|
|
|
| Report Abuse |
|
|
|
| 29 Jun 2013 09:30 PM |
| Eh this might not help, but if you want that code after the "if" to run then I think you might wanna put a then. Somehow I figure that this won't help, so if it doesn't, sorry I got nothing else. |
|
|
| Report Abuse |
|
|
|
| 29 Jun 2013 09:31 PM |
My mistake,
change local gui = script.GUI:Clone()
to
local gui = game.Lighting.GUI:Clone()
|
|
|
| Report Abuse |
|
|
|
| 29 Jun 2013 09:31 PM |
Think of it like this.
When a player joins, check if they're one of the people on the list, and give 'em the GUI if they are.
allowed = {"Player1","RandomName"}
function Player_Entered(player) --This is our function. for i = 1, #allowed, 1 do --This is a for loop, it will repeat an action for all the items on the list. if player.Name == allowed[i] then --Check if the player is one of them punks local gui_cpanel = game.Lighting.cPanel:clone() -- Give them the GUI gui_cpanel.Parent = player.PlayerGui --Set parent end --end if end --end for end --end function
--The next line is critical, it connects the function to an event so that the stuff gets done when the event happens. game.Players.PlayerAdded:connect(Player_Entered) --The function could have been named "bananas", and it still would work as long as you put "bananas" in between those ()'s
Take this code, look at it, examine it.
It's sort of intermediate though, so you should look at simpler scripts to understand.
The Unwise Wizard of Scripters has spoken. |
|
|
| Report Abuse |
|
|
skrank249
|
  |
| Joined: 03 Nov 2007 |
| Total Posts: 509 |
|
|
| 29 Jun 2013 09:36 PM |
| @Awsum does it need to be a localscript? it isnt working |
|
|
| Report Abuse |
|
|
|
| 29 Jun 2013 09:58 PM |
print("A")
local allowed = {"Player1","RandomName"}
print("B")
game.Players.PlayerAdded:connect(function(player)
print("C")
for i, v in pairs(allowed) do
print("D"..i)
if player.Name == v then
print("E"..i)
local gui_cpanel = game.Lighting.cPanel:clone() gui_cpanel.Parent = player.PlayerGui end end end)
print("F")
I wrote this, and it performs exactly the same function, but prints to the output each time something is done.
Troublingly, it only prints this when I test it in Play Solo: A B F
This means that the event isn't triggering, and I don't know why.
The Unwise Wizard of Scripters has spoken. |
|
|
| Report Abuse |
|
|
|
| 29 Jun 2013 11:08 PM |
allowed = {"Player1","RandomName"} g = game.Lighting.cPanel
function CheckAllowance(name) for i = 1,#allowed do if (string.upper(name) == string.upper(allowed[i])) then return true end end return false end
function onEntered(player) if CheckAllowance(player.Name) then g:clone().Parent = player.PlayerGui end
game.Players.PlayerAdded:connect(onEntered)
|
|
|
| Report Abuse |
|
|
|
| 29 Jun 2013 11:33 PM |
Forgot an end, bud.
The Unwise Wizard of Scripters has spoken. |
|
|
| Report Abuse |
|
|
|
| 30 Jun 2013 12:09 AM |
| PlayerAdded doesn't work in play solo. If you still can't get it to work then, try a localscript |
|
|
| Report Abuse |
|
|