Looks like there is a space right before SetRank [%20 means space in URI encoding schemes]
Odd, this is my server script when RankPlayer is fired:
game.ReplicatedStorage.RankPlayer.OnServerEvent:Connect(function(player)
if player:GetRankInGroup(4729062) < 238 then
print("Fired")
Server.SetRank(GroupId, player.UserId, 238)
end
end)
Group ID is defined above that, as well as the path to the server module.
Is there a way not to use glitch ?
You will have to get a domain along with a vps and then copy the files over. You would probably be better sticking with glitch.
Where should I ptu the Client and Server code? WHat do I have to change
Itās a tutorial, meaning you can see the code ā¦
Assuming you are talking about the example usage, it says Client Button, which is self explanatory, and server goes in Main.
Itās open sourced. You can see the code and thereās no cookie logging code in there.
Please donāt make gossip about this tutorial possibly stealing your cookie.
Anyone can say this about any open-source code, doesnāt make it true though.
It is your responsibility to keep your code/cookie safe, not the tutorials. The glitch site I provided does not log, track, or do anything with your cookie except use it with the noblox.js api.
Simple Answers to Your 'Problems'
Dont trust the open-source site that tons of people use?
Read the code.
Worried about losing your account?
Use an alt that only has ranking permissions.
Worried about getting your IP address leaked?
Use a VPN.
I am more than happy to address any other concerns you have.
Thanks a lot for this resource! Very simple to understand and helpful.
My game is looking like this:
In Server (normal script Server, not module script), path
is underlined orange.
Is this a problem, and have I done everything correctly?
(edit: opened the files etc donāt worry about previous question)
You should be doing this:
local Server = require(game:GetService("ServerScriptService").Main.Server)
I didnāt even realise , thanks for the help. Is everything else set up correctly though?
Content of Main
local HttpService = game:GetService("HttpService")
local Server = require(script.Server)
Content of Server (script)
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local Server = require(game:GetService("ServerScriptService").Main.Server)
local GroupId = 6532113
local Gamepasses = {
{
RankId = 15,
Id = 9885569
},
{
RankId = 25,
Id = 9885586
},
{
RankId = 10,
Id = 9885669
},
{
RankId = 20,
Id = 9885638
},
{
RankId = 40,
Id = 9885752
},
{
RankId = 45,
Id = 9885768
},
{
RankId = 50,
Id = 9885786
},
{
RankId = 30,
Id = 9885689
},
{
RankId = 35,
Id = 9885735
},
}
MarketplaceService.PromptGamePassPurchaseFinished:Connect(function(Player, GamepassId, wasPurchased)
if wasPurchased then
for _, Gamepass in pairs(Gamepasses) do
if Gamepass.Id == GamepassId then
if Player:GetRankInGroup(GroupId) < Gamepass.RankId then -- We don't want to demote them, but idk why they'd buy a lower rank...
Server.SetRank(GroupId, Player.UserId, Gamepass.RankId)
end
end
end
end
end)
Players.PlayerAdded:Connect(function(Player)
-- Less than the rank you're about to promote them to otherwise :shrug:
local HighestRankId = 50
for _, Gamepass in pairs(Gamepasses) do
if Player:GetRankInGroup(GroupId) < Gamepass.RankId and MarketplaceService:UserOwnsGamePassAsync(Player.UserId, Gamepass.Id) then
HighestRankId = HighestRankId < Gamepass.RankId and Gamepass.RankId or HighestRankId
end
end
if HighestRankId > 0 then
Server.SetRank(GroupId, Player.UserId, HighestRankId)
end
end)
Content of Configs
return {
-- NOTE: The final '/' in the URL is very important!
["BaseUrl"] = "link"; -- The base URL of your deployed server. Example: http://test-app.glitch.me/
["AUTH_KEY"] = "key"; -- Secret Key defined as 'auth_key' in the config.json file of your server
}
obviously replaced key and base url to my stuff
Content of Server (module script)
local Server = {}
local HttpService = game:GetService("HttpService")
local Configs = require(script.Parent.Configs)
local function Request(Function, RequestBody)
--Before sending the request, add our auth_key to the body
RequestBody["auth_key"] = Configs.AUTH_KEY
local response = HttpService:RequestAsync(
{
-- The website to send the request to. Function is the extended part of the URL for specific functions.
-- In this case, Function = 'GroupShout'
-- Example:
-- "Configs.BaseUrl..Function" would be equal to: http://test-app.glitch.me/GroupShout
Url = Configs.BaseUrl..Function,
-- The request method (all of ours will be POST)
Method = "POST",
-- We are sending JSON data in the body
Headers = {
["Content-Type"] = "application/json"
},
-- The body of the request containing the parameters for the request
Body = HttpService:JSONEncode(RequestBody)
}
)
if response.Success then
print("Status code:", response.StatusCode, response.Body)
print("Response body:\n", response.Body)
return response.Body
else
print("The request failed:", response.StatusCode, response.Body)
return response.Body
end
end
Server.Promote = function(GroupId, UserId)
assert(typeof(GroupId) == "number", "Error: GroupId must be an integer") -- Throw error if GroupId is not an integer
assert(typeof(UserId) == "number", "Error: UserId must be an integer") -- Throw error if UserId is not an integer
local Body = {
Group = GroupId;
Target = UserId;
}
-- pcall the function 'Request', with arguments 'Promote' and Body
local Success, Result = pcall(function()
return Request('Promote', Body)
end)
print(Result)
end
Server.Demote = function(GroupId, UserId)
assert(typeof(GroupId) == "number", "Error: GroupId must be an integer") -- Throw error if GroupId is not an integer
assert(typeof(UserId) == "number", "Error: UserId must be an integer") -- Throw error if UserId is not an integer
local Body = {
Group = GroupId;
Target = UserId;
}
local Success, Result = pcall(function()
return Request('Demote', Body)
end)
print(Result)
end
Server.SetRank = function(GroupId, UserId, RankId)
assert(typeof(GroupId) == "number", "Error: GroupId must be an integer") -- Throw error if GroupId is not an integer
assert(typeof(UserId) == "number", "Error: UserId must be an integer") -- Throw error if UserId is not an integer
assert(typeof(RankId) == "number", "Error: RankId must be an integer") -- Throw error if RankId is not an integer
local Body = {
Group = GroupId;
Target = UserId;
Rank = RankId;
}
local Success, Result = pcall(function()
return Request('SetRank', Body)
end)
print(Result)
end
Server.HandleJoinRequest = function(GroupId, PlayerUsername, Boolean)
assert(typeof(GroupId) == "number", "Error: GroupId must be an integer") -- Throw error if GroupId is not an integer
assert(typeof(PlayerUsername) == "string", "Error: PlayerUsername must be a string") -- Throw error if PlayerUsername is not a string
assert(typeof(Boolean) == "boolean", "Error: Boolean must be a boolean value") -- Throw error if Boolean is not a boolean value
local Body = {
Group = GroupId;
Username = PlayerUsername;
Accept = Boolean; -- true or false
}
local Success, Result = pcall(function()
return Request('HandleJoinRequest', Body)
end)
print(Result)
end
Server.GroupShout = function(GroupId, ShoutMessage)
assert(typeof(GroupId) == "number", "Error: GroupId must be an integer") -- Throw error if GroupId is not an integer
assert(typeof(ShoutMessage) == "string", "Error: ShoutMessage must be a string") -- Throw error if ShoutMessage is not a string
local Body = {
Group = GroupId;
Message = ShoutMessage;
}
local Success, Result = pcall(function()
return Request('GroupShout', Body)
end)
print(Result)
end
return Server
I would just move all of the contents in Server (Script) to Main.
Somewhat like what Vong25 said, you should only have 1 āServerā script. This should be a module script. In the path to server, put āscript.Serverā, assuming the path is in Main and Server is also a child of it.
Also, the code for the gamepasses should be in Main. The title Server implies that it is in ServerScriptService.
how would you add the automatic cookie pool system as you stated earlier?
How would you integrate it with your project?
How would I make a auto-accept join request center off of this?
Instead of ranking someone when they pass an application, use the join handle function.
Sorry I am not that good on scripting how would I make a script to run the accept join request on the event fire?