--Variables
local NP = 6074099
local NPEX = 7080836
local NPAD = 6098691
local NPCB = 6898345
--Making Clearance Level
game.Players.PlayerAdded:Connect(function(Player)
local ClearanceLevel = Instance.new("NumberValue",Player)
ClearanceLevel.Name = "ClearanceLevel"
--Setting Clearance Levels
if Player:GetRankInGroup(NP) == 255 then
Player.ClearanceLevel.Value = 10
else
if Player:GetRankInGroup(NP) == 254 then
Player.ClearanceLevel.Value = 9
else
if Player:GetRankInGroup(NPAD) == 250 then
Player.CleranceLevel.Value = 8
else
if Player:GetRankInGroup(NP) == 252 then
Player.ClearanceLevel.Value = 7
else
if Player:GetRankInGroup(NP) == 251 then
Player.CleranceLevel.Value = 7
else
if Player:IsInGroup(NPCB) then
Player.ClearanceLevel.Value = 6
else
if Player:GetRankInGroup(NPAD) == 150 then
Player.ClearanceLevel.Value = 5
else
if Player:GetRankInGroup(NPAD) == 100 then
Player.ClearanceLevel.Value = 5
else
if Player:GetRankInGroup(NP) == 125 then
Player.ClearanceLevel.Value = 4
else
if Player:GetRankInGroup(NP) == 120 then
Player.ClearanceLevel.Value = 2
else
if Player:IsInGroup(NPEX) then
Player.ClearanceLevel.Value = 1
else
Player.ClearanceLevel.Value = 0
end
end
end
end
end
end
end
end
end
end
end
end)
--Special Clearance Levels
game.Players.PlayerAdded:Connect(function(Player)
wait(4)
if Player.Name == "LordElectron59X" then
Player.ClearanceLevel.Value = 9
end
end)
And was wondering whether I could take this data and store it in a module script , so I can sync clearance across games?
Or if this data is not compatible to convert.
You can most definitely convert this in to a module script to answer your question directly.
I’m not sure what you mean by cross-game though, unless you plan to require the module via models or package linking.
The main issue I see isn’t so much the usage but how you’re handling it, why not make a table an irritate through that rather then doing a hundred different else statements?
you can put all those if statements in a module script
local y = {}
local validNPRanks = {
[255] = 10,
[254] = 9,
[252] = 7
[251] = 7
}
-- ect
function y.check(player)
local q = player:GetRankInGroup(NP) or nil
local x = player:GetRankInGroup(NPAD) or nil
local p = player:GetRankInGroup(NPCB) or nil
local k = player:GetRankInGroup(NPEX) or nil
if validNPRanks[q] ~= nil or validNPACRanks[x] ~= nil or validNPCBRanks[p] ~= nil or validNPEXRanks[k] ~= nil then
return validNPRanks[q] or validNPACRanks[x] or validNPCBRanks[p] or validNPEXRanks[k] -- returns the value
end
end
return y
-- watch this not work and make me look like a fool
local rank = require(game.ServerStorage.Check) -- module path
-- inside playeradded
local x = rank.check(player) or nil
if x == nil then
return
else
Player.ClearanceLevel.Value = x
end
local NP = 6074099
local NPEX = 7080836
local NPAD = 6098691
local NPCB = 6898345
local y = {}
local validNPRanks = {
[255] = 10,
[254] = 9,
[252] = 7,
[251] = 7,
[125] = 4,
[120] = 2,
[1] = 0,
}
local validNPADRanks = {
[250] = 8,
[150] = 5,
[100] = 5,
[1] = 0,
}
local validNPCBRanks = {
[3] = 6,
[2] = 6,
[1] = 6,
}
local validNPEXRanks = {
[50] = 1,
[100] = 5,
[200] = 7,
[250] = 9,
}
function y.check(player)
local q = player:GetRankInGroup(NP) or nil
local x = player:GetRankInGroup(NPAD) or nil
local p = player:GetRankInGroup(NPCB) or nil
local k = player:GetRankInGroup(NPEX) or nil
if validNPRanks[q] ~= nil or validNPADRanks[x] ~= nil or validNPCBRanks[p] ~= nil or validNPEXRanks[k] ~= nil then
return validNPRanks[q] or validNPADRanks[x] or validNPCBRanks[p] or validNPEXRanks[k] -- returns the value
end
end
return y
Loader:
local rank = require(5647241595) -- module path
game.Players.PlayerAdded:Connect(function(Player)
local ClearanceLevel = Instance.new("NumberValue",Player)
ClearanceLevel.Name = "ClearanceLevel"
local x = rank.check(player) or nil
if x == nil then
return
else
Player.ClearanceLevel.Value = x
end