Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I get my script to read all usernames in this table?

Asked by 5 years ago

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:

01local F = true
02 
03local NotSpecial = true
04 
05-------------------------------------------------------------------------------------------------------------------------------------------------
06 
07local FreeRank = 4
08 
09-------------------------------------------------------------------------------------------------------------------------------------------------
10 
11local Devs = {'ZeroNoey', 'mari888playsRX'}
12 
13local 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
14 
15local Immortal = ""
View all 86 lines...

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Well, first of all you're not getting data from the table. So lets fix that.

01-- Permission Lock Application
02 
03game.Players.PlayerAdded:Connect(function(Player)
04    for i, v in pairs(Devs) do
05        if Player.Name == v then
06            local DevH4x = Instance.new("NumberValue", Player)
07            DevH4x.Name = 'Rank'
08            DevH4x.Value = 999
09            F = false
10         end
11     end
12end)

Here's the other part:

01-- Special Permission Lock Application
02 
03game.Players.PlayerAdded:Connect(function(Player)
04    for i, v in pairs(SpecialPerms) do
05        if Player.Name == v then
06           local SpecPerms = Instance.new("BoolValue", Player)
07           SpecPerms.Name = 'SpecialPermissions'
08           SpecPerms.Value = true
09           NotSpecial = false
10        elseif NotSpecial then
11           local SpecPerms = Instance.new("BoolValue", Player)
12           SpecPerms.Name = 'SpecialPermissions'
13           SpecPerms.Value = false
14        end
15    end
16end)
0
Thank you so much! It's in working condition now :) I had a feeling I would have had to change it to "for i, v," but I didn't really know how to make it grab from the table; til. ZeroNoey 19 — 5y
0
No problem! I enjoy making people happy :-) PracticalManner 15 — 5y
Ad

Answer this question