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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: tables and such

Previous Thread :: Next Thread 
Exzeption is not online. Exzeption
Joined: 01 Nov 2011
Total Posts: 1312
30 Jul 2015 02:12 PM
admins = {"Exzeption"}

game.Players.PlayerAdded:connect(function(plar)
print("1")
local c = Instance.new("BoolValue", plar)
c.Name = "tru"
for i, v in next, admins do
print("2")
if v.Name == plar.Name then
print("3")
plar.tru.Value = true
else
print("4")
plar.tru.Value = false
end
end
end)

if the output i get 1 2 4 2 4
Report Abuse
Exzeption is not online. Exzeption
Joined: 01 Nov 2011
Total Posts: 1312
30 Jul 2015 02:13 PM
i think it has to do with the tables, i never got much practice with those
Report Abuse
Exzeption is not online. Exzeption
Joined: 01 Nov 2011
Total Posts: 1312
30 Jul 2015 02:24 PM
bum
Report Abuse
Exzeption is not online. Exzeption
Joined: 01 Nov 2011
Total Posts: 1312
30 Jul 2015 04:56 PM
p
Report Abuse
Marzlyn is not online. Marzlyn
Joined: 15 Jun 2014
Total Posts: 4431
30 Jul 2015 05:00 PM
try do if v.Name:lower() == plar.Name:lower() instead


Is have grammar booK? send for is me '-'
Report Abuse
Exzeption is not online. Exzeption
Joined: 01 Nov 2011
Total Posts: 1312
30 Jul 2015 05:04 PM
What does lower do?
Report Abuse
Marzlyn is not online. Marzlyn
Joined: 15 Jun 2014
Total Posts: 4431
30 Jul 2015 05:05 PM
It changes both of them to lower case
let's say for instance in the table you have it as "MARZN" but ingame ROBLOX made my casing as "Marzlyn"

it's case sensitive
try it


Is have grammar booK? send for is me '-'
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
30 Jul 2015 05:12 PM
local admins = {}

local IsAdmin = function(p)
for _,name in next, admins do
if p.Name == name then
return true -- Do NOT use an else because that will just return false if the player's name is not the first name the loop gets to
end
end
return false -- You return here, if none of the names in the table match the player's then it will not return in the loop and so the code will continue to here
end


game.Players.PlayerAdded:connect(function(player)
local c = Instance.new("BoolValue",player)
c.Name = "tru" -- You already have a variable of it so there is no point in doing player.tru to get it
if IsAdmin(player) then
c.Value = true
else
c.Value = false
end
end)
Report Abuse
Exzeption is not online. Exzeption
Joined: 01 Nov 2011
Total Posts: 1312
30 Jul 2015 05:12 PM
Now it gets stuck on

if v.Name:lower() == plar.Name:lower() then

the output says

18:10:11.987 - Workspace.Script:11: attempt to index field 'Name' (a nil value)
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
30 Jul 2015 05:16 PM
Also do NOT check the named lower cased, roblox names are case sensitive and so if a player with the same name but different casing joins it will let him/her through as admin.
Report Abuse
Exzeption is not online. Exzeption
Joined: 01 Nov 2011
Total Posts: 1312
30 Jul 2015 05:19 PM
Thanks chimmihc
Report Abuse
Marzlyn is not online. Marzlyn
Joined: 15 Jun 2014
Total Posts: 4431
30 Jul 2015 05:20 PM
that's why i made both of them lower cased you silly!


Is have grammar booK? send for is me '-'
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
30 Jul 2015 05:23 PM
This is why you don't check the names lower cased:


Admin list: {"chimmihc"}
Player: ChimMihc joins -- passes as admin
Player: chimmihc joins -- passes as admin


See the problem?
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
30 Jul 2015 05:24 PM
@chim

You cannot make an account called WARSPYKING.

Go ahead and try it.

It may be case sensitive, but to avoid confusion they wouldn't allow a user "hello" and a user "HeLlO", you can see this in party chat, when you invite someone it doesn't care if you give it the correct cases.
Report Abuse
Marzlyn is not online. Marzlyn
Joined: 15 Jun 2014
Total Posts: 4431
30 Jul 2015 05:25 PM
em mate im pretty sure you CANT create users repetitively on ROBLOX with different casing LOL

this is what happens

>Player joins
>Both what's inside the table and the player's name get lower/upper cased to be valid for a comparison
>Value gets changed


Is have grammar booK? send for is me '-'
Report Abuse
Marzlyn is not online. Marzlyn
Joined: 15 Jun 2014
Total Posts: 4431
30 Jul 2015 05:26 PM
dang it war
i actually didnt copy you lol i was just hesitating in case i misunderstood him


Is have grammar booK? send for is me '-'
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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