Hello!
I am having a problem with my automatic ranking system.
And it works like this:
If a bob has 200
points, then it promotes bob.
Error:
It won’t promote me.
[I am not the group owner by the way if your wondering]
local DataStoreService = game:GetService('DataStoreService')
local PointsDataStore = DataStoreService:GetOrderedDataStore("Points")
local MinutesDataStore = DataStoreService:GetOrderedDataStore("Minutes")
local GlitchURL = ""
function rankUser(UserId, RoleId)
game:GetService("HttpService"):GetAsync(GlitchURL .. "ranker?userid=" .. UserId .. "&rank=" .. RoleId)
end
game.Players.PlayerAdded:Connect(function(Player)
local Folder = Instance.new('Folder',Player)
Folder.Name = "leaderstats"
local Min = Instance.new('NumberValue',Folder)
Min.Name = "Points"
Min.Value = PointsDataStore:GetAsync(Player.UserId) or 0
local Points = Instance.new('NumberValue',Folder)
Points.Name = "Time Spent"
Points.Value = MinutesDataStore:GetAsync(Player.UserId) or 0
local Rank = Instance.new('IntValue', Folder)
Rank.Value = Player:GetRoleInGroup(4512072)
Rank.Name = "Drips Rank"
game.ReplicatedStorage.PointsEvent.OnServerInvoke = function(Player,Key,PointsVal)
if not Key or Key == '' then Player:Kick("\nmsdos\nmk\nstop\nexploiting") end
if Key == '' then
Min.Value = Points.Value + PointsVal
else
Player:Kick("why do u have to exploit???!??!?!?!??!??!?!")
end
end
game.Players.PlayerRemoving:Connect(function()
PointsDataStore:SetAsync(Points.Value, true)
MinutesDataStore:SetAsync(Min.Value, true)
end)
Min.Changed:Connect(function()
PointsDataStore:SetAsync(Min.Value, true)
if Min.Value == 200 then
rankUser(Player.UserId, 4)
elseif Min.Value == 300 then
rankUser(Player.UserId, 5)
elseif Min.Value == 500 then
rankUser(Player.UserId, 6)
elseif Min.Value == 700 then
rankUser(Player.UserId, 7)
elseif Min.Value == 1000 then
rankUser(Player.UserId, 8)
end
end)
end)
Points.Changed:Connect(function()
Min:SetAsync(Points.Value, true)
end)
end)
Btw I used a pcall
to get the error.