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
|
  |
| 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
|
  |
| Joined: 01 Nov 2011 |
| Total Posts: 1312 |
|
| |
|
Exzeption
|
  |
| Joined: 01 Nov 2011 |
| Total Posts: 1312 |
|
| |
|
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
|
  |
| Joined: 01 Nov 2011 |
| Total Posts: 1312 |
|
| |
|
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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 01 Nov 2011 |
| Total Posts: 1312 |
|
| |
|
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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|