generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Your going to laugh.

Previous Thread :: Next Thread 
skrank249 is not online. 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 is not online. skrank249
Joined: 03 Nov 2007
Total Posts: 509
29 Jun 2013 09:22 PM
Help?
Report Abuse
Saviorofdragons is not online. Saviorofdragons
Joined: 10 Jan 2013
Total Posts: 489
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 is not online. 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
MassiveGman is not online. MassiveGman
Joined: 23 Jan 2011
Total Posts: 2019
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
Saviorofdragons is not online. Saviorofdragons
Joined: 10 Jan 2013
Total Posts: 489
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
MassiveGman is not online. MassiveGman
Joined: 23 Jan 2011
Total Posts: 2019
29 Jun 2013 09:31 PM
My mistake,

change local gui = script.GUI:Clone()

to

local gui = game.Lighting.GUI:Clone()
Report Abuse
awsumpwner27 is not online. awsumpwner27
Joined: 03 Sep 2011
Total Posts: 4389
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 is not online. 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
awsumpwner27 is not online. awsumpwner27
Joined: 03 Sep 2011
Total Posts: 4389
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
DoctorTempest is not online. DoctorTempest
Joined: 05 Jan 2013
Total Posts: 3838
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
awsumpwner27 is not online. awsumpwner27
Joined: 03 Sep 2011
Total Posts: 4389
29 Jun 2013 11:33 PM
Forgot an end, bud.

The Unwise Wizard of Scripters has spoken.
Report Abuse
DarkDemon01 is not online. DarkDemon01
Joined: 20 Sep 2008
Total Posts: 9277
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image