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: What's wrong with this script?

Previous Thread :: Next Thread 
Surgo is not online. Surgo
Joined: 11 Jan 2011
Total Posts: 2748
21 Jul 2014 08:21 PM
local admins = script:WaitForChild("Admins").Value

function isAdmin(name)
for i,v in pairs(admins) do
if name:lower() == v:lower() then
c = script.AdminGui:Clone()
c.Parent = newPlayer.PlayerGui
end
end
end

Report Abuse
UncleTaz is not online. UncleTaz
Joined: 19 Aug 2009
Total Posts: 12795
21 Jul 2014 08:22 PM
What do you want to happen?
Report Abuse
Surgo is not online. Surgo
Joined: 11 Jan 2011
Total Posts: 2748
21 Jul 2014 08:26 PM
Admins is a String Value, and obviously its filled with name.

When you join the server and you're an "Admin", then it'll clone "AdminGui" into PlayerGui.
Report Abuse
Xephyric is not online. Xephyric
Joined: 26 Mar 2009
Total Posts: 2270
21 Jul 2014 08:26 PM
WaitForChild is unreliable and often does not work. Instad do
while not script:findFirstChild("Admins") do script.ChildAdded:wait() end
local admins = script.Admins.Value

from here on I'm not sure what you're doing, because you are trying to iterate through a value.

Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
21 Jul 2014 08:29 PM
well value isnt a table so it wont work
Report Abuse
Xephyric is not online. Xephyric
Joined: 26 Mar 2009
Total Posts: 2270
21 Jul 2014 08:29 PM
Your stringvalue holds A string. Hence one thing. doing for i,v in pairs(admins) will not work because you cannot iterate through a string. Instead bring the list into the script

your list may be "you,me,pineapples" while

this table has three strings
admins = {"you","me","pineapples"}

for i,v in pairs(admins) do
end
Report Abuse
UncleTaz is not online. UncleTaz
Joined: 19 Aug 2009
Total Posts: 12795
21 Jul 2014 08:30 PM
Admins = {["Name"] = true}

game:GetService("Players").PlayerAdded:connect(function(Player()
if admins[Player.Name] then
c = script.AdminGui:clone()
c.Parent = Player:WaitForChild("PlayerGui")
end
end)
Report Abuse
UncleTaz is not online. UncleTaz
Joined: 19 Aug 2009
Total Posts: 12795
21 Jul 2014 08:31 PM
Oops

*(function(Player)
Report Abuse
Surgo is not online. Surgo
Joined: 11 Jan 2011
Total Posts: 2748
21 Jul 2014 08:37 PM
How do I add multiple players to the list?
Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
21 Jul 2014 08:38 PM
Admins = {["Name"] = true,["smile599"]=true}
Report Abuse
Xephyric is not online. Xephyric
Joined: 26 Mar 2009
Total Posts: 2270
21 Jul 2014 08:46 PM
Also you don't have anything triggering your function for when the player joins the game


game.Players.PlayerAdded:connect(isAdmin)
Report Abuse
UncleTaz is not online. UncleTaz
Joined: 19 Aug 2009
Total Posts: 12795
21 Jul 2014 08:49 PM
@Xephyric

Uh no lol

My script works fine.

Test it if you like.

replace his code thread with

print ' Oh look an admin '
Report Abuse
UncleTaz is not online. UncleTaz
Joined: 19 Aug 2009
Total Posts: 12795
21 Jul 2014 08:50 PM
Oh you're talking about his script, :P

Well nvm.
Report Abuse
Xephyric is not online. Xephyric
Joined: 26 Mar 2009
Total Posts: 2270
21 Jul 2014 08:51 PM
Did not see your script, I telling OP
Report Abuse
Xephyric is not online. Xephyric
Joined: 26 Mar 2009
Total Posts: 2270
21 Jul 2014 08:51 PM
I was telling*
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