Roblox Bot scripting Help

Hi,
We have an auto rank bot for a training game which should do: when a player enters a user id into a TextBox it will rank the player to another rank (Rank ID 2). This should work by going through a 3rd party website called Glitch. The bit that doesn’t work could be anywhere in this process but we did a print() test from the local script but the print didn’t come out in the output.
Thanks
(scripts below)

LOCAL SCRIPT SERVERSCRIPTSERVICE

local GlitchURL = "https://the-railway-bot.glitch.me/" --Place the glitch project URL inside of the quotes

function rankUser(UserId, RoleId)
    game:GetService("HttpService"):GetAsync(GlitchURL .. "ranker?userid=" .. UserId .. "&rank=" .. RoleId)
end
    
game.ReplicatedStorage.QDPASS.OnServerEvent:Connect(function(Player)

local UserId = game.StarterGui.guiqd.Frame.TextBox.Text --Replace 12345 with the users userid
local RoleId = 2 --Replace 255 with the role id that you would like the user to be set to
end)

SCRIPT IN THE TEXTBUTTON

script.Parent.MouseButton1Click:Connect(function()
    game.ReplicatedStorage.QDPASS:FireServer()
    
end)
print("3454323456")
1 Like
  • Pretty sure you never call rankUser in your code
  • local UserId = game.StarterGui.guiqd.Frame.TextBox.Text --Replace 12345 with the users userid Just want to mention that ScreenGui that are visible to the player are parented to PlayerGui, you can’t get the user id from StarterGui
2 Likes

Your rankUser funciton is not being called in the script in ServerScriptService:

Here’s what your script should look like:

local GlitchURL = "https://the-railway-bot.glitch.me/" --Place the glitch project URL inside of the quotes
local RoleId = 2

function rankUser(UserId, RoleId)
    game:GetService("HttpService"):GetAsync(GlitchURL .. "ranker?userid=" .. UserId .. "&rank=" .. RoleId)
end
    
game.ReplicatedStorage.QDPASS.OnServerEvent:Connect(function(Player)
    rankUser(Player.UserId, RoleId)
end)
1 Like

when a player enters a user id into a TextBox it will rank the player to another rank

rankUser(Player.UserId, RoleId) I don’t think this is ranking the correct user
Here’s a modified version of @TheSuzerain’s answer that should work as intended

local GlitchURL = "https://the-railway-bot.glitch.me/" --Place the glitch project URL inside of the quotes
local RoleId = 2

function rankUser(UserId, RoleId)
    game:GetService("HttpService"):GetAsync(GlitchURL .. "ranker?userid=" .. UserId .. "&rank=" .. RoleId)
end
    
game.ReplicatedStorage.QDPASS.OnServerEvent:Connect(function(Player, userId)
    rankUser(userId, roleId)
end)
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
   game.ReplicatedStorage.QDPASS:FireServer(LocalPlayer.PlayerGui:WaitForChild("guiqd").Frame.TextBox.Text)
end)

PS, you should change the glitch url. Someone could easily use that to change other people’s rank without their permission

Hi, thank you for the feedback but unfortunately the scripts didn’t work.

The LocalScript is incorrect.

You can’t use MouseButton1Click if you wanna get text from a text box.

You need to use TextBox.FocusLost to get the text of a TextBox to successfully fire the user’s ID to the server.

You can visit TextBox | Roblox Creator Documentation for more details. But for now, here’s what @myhorselover5’s scripts should look like:

LocalScript inside TextBox:

local textBox = script.Parent

textBox.FocusLost:Connect(function(enterPressed, inputObject)
    if enterPressed then
        local Text = textBox.Text
        local ID = tonumber(Text)
        game.ReplicatedStorage.QDPASS:FireServer(ID)
    end
end)

Script inside ServerScriptService:

local GlitchURL = "https://the-railway-bot.glitch.me/" --Place the glitch project URL inside of the quotes
local RoleId = 2

function rankUser(UserId, RoleId)
    game:GetService("HttpService"):GetAsync(GlitchURL .. "ranker?userid=" .. UserId .. "&rank=" .. RoleId)
end
    
game.ReplicatedStorage.QDPASS.OnServerEvent:Connect(function(Player, userId)
    rankUser(userId, RoleId)
end)
2 Likes

The script was in a text button and only got activated when you would click it, will this script still work?

If you want a TextButton to be pressed before firing the ID to the server, then it will not work.

In that case, then the action for MouseButton1Click was correct.

You can put a local script inside the ScreenGui where your ranking panel is and define the variables that are undefined in this script below:

-- Make sure this goes inside the ScreenGui where all your buttons/boxes are and NOT inside the TextBox/TextButton, that may cause it to not function.
local textButton = Path.To.TextButton
local textBox = Path.To.TextBox

textButton.MouseButton1Click:Connect(function()
    local Text = textBox.Text
    local ID = tonumber(Text)
    game.ReplicatedStorage.QDPASS:FireServer(ID)
end)

The script in ServerScriptService should be able to stay the same as the one I put before.

My apologies for not fully understanding what you’re asking. Let me know if you have any more questions!

Hi, unfortunately when the serverscript runs this error comes out in the output:
ServerScriptService.qd:5: attempt to concatenate Instance with string

Just to clarify, what is line 5 of your script in ServerScriptService?

game:GetService(“HttpService”):GetAsync(GlitchURL … “ranker?userid=” … UserId … “&rank=” … RoleId)

For testing purposes, could you try replacing lines 4-6 with this and then running the game and tell me what it prints:

function rankUser(UserId, RoleId)
    print(UserId)
    print(RoleId)
    game:GetService("HttpService"):GetAsync(GlitchURL .. "ranker?userid=" .. UserId .. "&rank=" .. RoleId)
end
1 Like

it printed this:
my username and 2

Wait…are you entering people’s usernames or UserID’s into the TextBox?

i entered my alt accounts userid then clicked the enter button but it still came with my username