I'm making a script that will add a number value to a player when they join the game. I want to use this value to restrict access to certain GUI commands to people with higher values. To do this, I created a bunch of tables for different ranks. However, whenever I enter a team test in the studio (to test it with my friend), I am the only one who gets the proper value (999). My friend gets the value 4, which I set as the default. I am the first string in the table, so it is probably related to that, but I still don't know what to do... How can I edit the script so that all names in the table are given the proper number value?
Here is the script:
local F = true local NotSpecial = true ------------------------------------------------------------------------------------------------------------------------------------------------- local FreeRank = 4 ------------------------------------------------------------------------------------------------------------------------------------------------- local Devs = {'ZeroNoey', 'mari888playsRX'} local Destructive = "addie5000","XxPaul_GamerxX","eatthememesboiiii","fakenatural" -- I haven't edited this line yet because I can't even get the first table to work properly local Immortal = "" local Strong = "" local Basic = "" local Cosmetic = "" ------------------------------------------------------------------------------------------------------------------------------------------------- local SpecialPerms = "ZeroNoey","mari888playsRX","addie5000","XxPaul_GamerxX","eatthememesboiiii","fakenatural" ------------------------------------------------------------------------------------------------------------------------------------------------- -- Permission Lock Application game.Players.PlayerAdded:Connect(function(Player) if Player.Name == Devs then local DevH4x = Instance.new("NumberValue", Player) DevH4x.Name = 'Rank' DevH4x.Value = 999 F = false elseif Player.Name == Destructive then local Eraserr = Instance.new("NumberValue", Player) Eraserr.Name = 'Rank' Eraserr.Value = 5 F = false elseif Player.Name == Immortal then local nodie = Instance.new("NumberValue", Player) nodie.Name = 'Rank' nodie.Value = 4 F = false elseif Player.Name == Strong then local localbodybuilder = Instance.new("NumberValue", Player) localbodybuilder.Name = 'Rank' localbodybuilder.Value = 3 F = false elseif Player.Name == Basic then local fatSam = Instance.new("NumberValue", Player) fatSam.Name = 'Rank' fatSam.Value = 2 F = false elseif Player.Name == Cosmetic then local dancin = Instance.new("NumberValue", Player) dancin.Name = 'Rank' dancin.Value = 1 F = false elseif F then local f = Instance.new("NumberValue", Player) f.Name = 'Rank' f.Value = FreeRank end end) ------------------------------------------------------------------------------------------------------------------------------------------------- -- Special Permission Lock Application game.Players.PlayerAdded:Connect(function(Player) if Player.Name == SpecialPerms then local SpecPerms = Instance.new("BoolValue", Player) SpecPerms.Name = 'SpecialPermissions' SpecPerms.Value = true NotSpecial = false elseif NotSpecial then local SpecPerms = Instance.new("BoolValue", Player) SpecPerms.Name = 'SpecialPermissions' SpecPerms.Value = false end end) -------------------------------------------------------------------------------------------------------------------------------------------------
Well, first of all you're not getting data from the table. So lets fix that.
-- Permission Lock Application game.Players.PlayerAdded:Connect(function(Player) for i, v in pairs(Devs) do if Player.Name == v then local DevH4x = Instance.new("NumberValue", Player) DevH4x.Name = 'Rank' DevH4x.Value = 999 F = false end end end)
Here's the other part:
-- Special Permission Lock Application game.Players.PlayerAdded:Connect(function(Player) for i, v in pairs(SpecialPerms) do if Player.Name == v then local SpecPerms = Instance.new("BoolValue", Player) SpecPerms.Name = 'SpecialPermissions' SpecPerms.Value = true NotSpecial = false elseif NotSpecial then local SpecPerms = Instance.new("BoolValue", Player) SpecPerms.Name = 'SpecialPermissions' SpecPerms.Value = false end end end)