Someone Help me on this one

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.

1 Like

Hey my buddy. lol hi

Well it might be an error on glitch’s side. Your code on Roblox looks good.
Mind showing the error on glitch’s output?
Try inserting a new cookie in the bot account and yeah.

	Points.Changed:Connect(function()
		Min:SetAsync(Points.Value, true)
	end)

Doesn’t make sense - Min is a NumberValue and you probably don’t want to set it to Points anyways

		PointsDataStore:SetAsync(Min.Value, true)

You probably meant MinutesDataStore?

			Min.Value = Points.Value + PointsVal

Also seems wrong - shouldn’t this be Points.Value = ?

What is “GlitchURL”? Is that supposed to be an API? What does it do?

Also… if you’re trying to prevent exploiting, that is not a good way to do it :slight_smile: An exploiter could figure out what the key is and send it. The client should never be in charge of commanding point values in the first place.

Try doing something with < and >. Try:

if Min.Value>199 and Min.Value <300 then --checks if the value is above 199 and below 300
rankUser(Player.UserId, 4)
end

I hope i didn’t mess up, and I hope this helped.
Have a nice day :slight_smile:

I’d recommend using Datastore2 for savind and loading data since right now it’s most efficient for data loss. And also do you want the ranking to be infinite? Or is there a maxium number of rank users can achieve?