Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Anyone know how I can make a variable to get a players UserId and RoleId?

So I am trying to make an auto ranking bot, I have everything done apart from getting the users ID and their group RoleId, and as this is an army group I am making this for, I can't just hardcode it every time.

this is the script I have (it uses glitch.com):

local GlitchURL = "idf-ranking-bot.glitch.me" --Place the glitch project URL inside of the quotes
 
unction rankUser(UserId, RoleId)
game:GetService("HttpService"):GetAsync(GlitchURL .. "ranker?userid=" .. UserId .. "&rank=" .. RoleId)
end
local UserId = 12345 --Replace 12345 with the users userid
local RoleId = 255 --Replace 255 with the role id that you would like the user to be set to
rankUser(UserId, RoleId)

I need to change the local UserId and local RoleId into variables that can be taken from the game if they get promoted, and I can't figure out how. Ideas anyone?

1 answer

I know how to get the player's user id, but not the role id.

game.Players.PlayerAdded:Connect(function(player)
	local UserId = player.UserId
end)

1 comment

0

so that would replace this part of the code: local UserId = 12345 --Replace 12345 with the users userid ?

This discussion is preserved as it was. New answers, comments, and votes are closed.