Hello :
Greetings , I am a newbie scripter [I just started a few weeks ago] and I am trying to use Cookie’s Tech Group Ranking Bot , I would use it so that when a player stay longer in a game , that player would get ranked in the group. [For Example , every 5 Mins , the player would get ranked]
Notes :
Url / API / GroupID is correct
No output / F9 Error
My local minutes that is seen in code line 14 is working properly
Cookie is alive since I can manually use the heroku link to rank.
Heroku Logs : Nothing happen in the console log which means I forgot something (heroku is working but nothing happen with this code)
local HttpService = game:GetService("HttpService")
local url = "CENSORED/group/rank"
local APIKEY = "CENSORED"
local groupId = CENSORED
local plr = game.Players.LocalPlayer
function rankUser(plr,role_number)
HttpService:GetAsync(url.."?user_name="..plr.Name.."&key=".. APIKEY.."&groupid=" ..groupId.."&role_number="..role_number)
end
game.Players.PlayerAdded:Connect(function(plr,role_number)
local Minutes = plr:WaitForChild("leaderstats").Minutes
if plr:IsInGroup(groupId) and plr:GetRankInGroup(groupId) >= 1 then
Minutes.Changed:Connect(function()
local role_number
if Minutes.Value >= 0 then
role_number=3
rankUser(role_number)
elseif Minutes.Value >= 2 then
role_number=4
rankUser(role_number)
end
end)
end
end)
Requesting Help :
I’m pretty sure that this is not working due to my lack of skill in scripting and that is why I request someone to actually tell me what I did wrong and what is missing.
function rankUser(plr,role_number)
local response = HttpService:GetAsync(url.."?user_name="..plr.Name.."&key=".. APIKEY.."&groupid=" ..groupId.."&role_number="..role_number)
local data = HttpService:JSONDecode(response)
print(data.Body)
end
Thanks :
I thank you for these advices that also helped me to understand more about functions , I added data back and it indeed worked but I found another issue.
Explanation :
The script would check if minute has been updated , if yes , it would check the value of Minute to change the rank , but it only check the first requirement which is “>=0” , after that it won’t check about “>=2” like the player would get ranked “rank2” to “rank3” when requirements is meet but it stay in “rank2” , should I change it to “==” instead of “>=” ?
Codes :
local HttpService = game:GetService("HttpService")
local url = "CENSORED/group/rank"
local APIKEY = "CENSORED"
local groupId = CENSORED
local plr = game.Players
function rankUser(plr,role_number)
local response = HttpService:GetAsync(url.."?user_name="..plr.Name.."&key=".. APIKEY.."&groupid=" ..groupId.."&role_number="..role_number)
local data = HttpService:JSONDecode(response)
print(data.Body)
end
game.Players.PlayerAdded:Connect(function(plr)
local Minutes = plr:WaitForChild("leaderstats").Minutes
if plr:IsInGroup(groupId) and plr:GetRankInGroup(groupId) >= 1 then
Minutes.Changed:Connect(function()
if Minutes.Value >= 0 then
rankUser(plr,3)
elseif Minutes.Value >= 2 then
rankUser(plr,4)
elseif Minutes.Value >= 5 then
rankUser(plr,5)
end
end)
end
Logs :
Heroku Logs : We can see that it still try to rank for the first requirements
Additional Question : Does the cookie have to verified and uptated every “x” time or is there already something that manage to keep it alive / non-expired / uptated.
Hello :
Sorry for responding too late , my roblox account got hacked yesterday and I lost all of my robux and almost all of my game project has been stolen / deleted / taken down by roblox moderation team , I managed to keep my roblox group.
What I Tried :
As I said , my skill in scripting is not that good and I tried what you told me to try but without results because of my lack of skills , so I tried to try other things and I actually made the code worse but managed to make it work as I wanted .
Instead of using “elseif” , I only used a lot of “if” and tried this :
if Minutes.Value >= 0 and Minutes.Value <= 5 then
rankUser(plr,3)
end
if Minutes.Value >= 5 and Minutes.Value <= 10 then
rankUser(plr,4)
end
Using this :
I know that using this is really bad since it would make a request every time that Minutes is changed and will try to change role to user even if user already have rank : like last time , but It actually apply all requirements.
I will improve this code and try what you told me to do when I have free time and when I will recover from losing my account.