!promote !demote commands isn't working

Hello I have a problem with promote and demote commands. I made it for my friend. In my friend game isn’t working. Imgur: The magic of the Internet but in place that I downloaded from this page works but have a problem Imgur: The magic of the Internet.

1 Like

Can you show us the code? Once you inserted the code into here, please highlight it and press the button that looks like a </>.

My friend

local HttpService = game:GetService("HttpService")
local ReplicatedStorage = game.ReplicatedStorage
local AppUrl = script.AppUrl.Value
local ApiKey = script.ApiKey.Value
local Groupid = script.GroupId.Value
local MinRank = script.MinRank.Value
local prefix = "!"



local function FindPlr(plr)
	local foundPlr = nil
	local plrs = game.Players:GetPlayers()
	for i = 1, #plrs do
		local current = plrs[i]
		if string.lower(current.Name):sub(1, #plr) == string.lower(plr) then
			foundPlr = current.Name
			break
		end
	end
	return foundPlr
end


game.Players.PlayerAdded:Connect(function(player)
	player.Chatted:Connect(function(msg)
		if player:GetRankInGroup(Groupid) >= 2 then
			local LowerCaseMessage = string.lower(msg)
			if string.find(LowerCaseMessage, prefix.. "promote") then
				local SplitMessage = string.split(msg, " ")
				local full_player = FindPlr(SplitMessage[2])
				if full_player == nil then
					local playerInstance = game.Players:FindFirstChild(player.Name)
					game.ReplicatedStorage.Notify:FireClient(playerInstance, "Uh-Oh","We couldn't find the player you wanted to promote!")
				else
					local playerInstance = game.Players:FindFirstChild(player.Name)
					game.ReplicatedStorage.Notify:FireClient(playerInstance, "Attempting.","Attempting to promote user...")
					local Url = script.AppUrl.Value.."group/promote?user_name="..full_player.."&key=" ..script.ApiKey.Value.."&groupid="..script.GroupId.Value
					local success, response = pcall(function()
						local response = HttpService:GetAsync(Url)
						local data = HttpService:JSONDecode(response)
					end)
					if success then
						game.ReplicatedStorage.Notify:FireClient(playerInstance, "Horrah!","We promoteed the user!")
					else
						game.ReplicatedStorage.Notify:FireClient(playerInstance, "Uh-Oh","We had problems promoting the user.")
					end
				end
			else if string.find(LowerCaseMessage, prefix.. "demote") then
					local SplitMessage = string.split(msg, " ")
					local full_player = FindPlr(SplitMessage[2])
					if full_player == nil then
						local playerInstance = game.Players:FindFirstChild(player.Name)
						game.ReplicatedStorage.Notify:FireClient(playerInstance, "Uh-Oh","We couldn't find the player you wanted to demote!")
					else
						local playerInstance = game.Players:FindFirstChild(player.Name)
						game.ReplicatedStorage.Notify:FireClient(playerInstance, "Attempting.","Attempting to demote user...")
						local Url = script.AppUrl.Value.."group/demote?user_name="..full_player.. "&key=" ..script.ApiKey.Value.. "&groupid=" ..script.GroupId.Value
						local success, response = pcall(function()
							local response = HttpService:GetAsync(Url)
							local data = HttpService:JSONDecode(response)
						end)
						if success then
							game.ReplicatedStorage.Notify:FireClient(playerInstance, "Horrah!","We demoted the user!")
						else
							game.ReplicatedStorage.Notify:FireClient(playerInstance, "Uh-Oh","We had problems demoting. the user.")
						end
					end
				end
			end
		end
	end)
end)





Downloaded

local HttpService = game:GetService("HttpService")
local ReplicatedStorage = game.ReplicatedStorage
local AppUrl = script.AppUrl.Value
local ApiKey = script.ApiKey.Value
local Groupid = script.GroupId.Value
local MinRank = script.MinRank.Value
local prefix = "!"



local function FindPlr(plr)
	local foundPlr = nil
	local plrs = game.Players:GetPlayers()
	for i = 1, #plrs do
		local current = plrs[i]
		if string.lower(current.Name):sub(1, #plr) == string.lower(plr) then
			foundPlr = current.Name
			break
		end
	end
	return foundPlr
end


game.Players.PlayerAdded:Connect(function(player)
	player.Chatted:Connect(function(msg)
		if player:GetRankInGroup(Groupid) >= 2 then
			local LowerCaseMessage = string.lower(msg)
			if string.find(LowerCaseMessage, prefix.. "promote") then
				local SplitMessage = string.split(msg, " ")
				local full_player = FindPlr(SplitMessage[2])
				if full_player == nil then
					local playerInstance = game.Players:FindFirstChild(player.Name)
					game.ReplicatedStorage.Notify:FireClient(playerInstance, "Uh-Oh","We couldn't find the player you wanted to promote!")
				else
					local playerInstance = game.Players:FindFirstChild(player.Name)
					game.ReplicatedStorage.Notify:FireClient(playerInstance, "Attempting.","Attempting to promote user...")
					local Url = script.AppUrl.Value.."group/promote?user_name="..full_player.."&key=" ..script.ApiKey.Value.."&groupid="..script.GroupId.Value
					local success, response = pcall(function()
						local response = HttpService:GetAsync(Url)
						local data = HttpService:JSONDecode(response)
					end)
					if success then
						game.ReplicatedStorage.Notify:FireClient(playerInstance, "Horrah!","We promoteed the user!")
					else
						game.ReplicatedStorage.Notify:FireClient(playerInstance, "Uh-Oh","We had problems promoting the user.")
					end
				end
			else if string.find(LowerCaseMessage, prefix.. "demote") then
					local SplitMessage = string.split(msg, " ")
					local full_player = FindPlr(SplitMessage[2])
					if full_player == nil then
						local playerInstance = game.Players:FindFirstChild(player.Name)
						game.ReplicatedStorage.Notify:FireClient(playerInstance, "Uh-Oh","We couldn't find the player you wanted to demote!")
					else
						local playerInstance = game.Players:FindFirstChild(player.Name)
						game.ReplicatedStorage.Notify:FireClient(playerInstance, "Attempting.","Attempting to demote user...")
						local Url = script.AppUrl.Value.."group/demote?user_name="..full_player.. "&key=" ..script.ApiKey.Value.. "&groupid=" ..script.GroupId.Value
						local success, response = pcall(function()
							local response = HttpService:GetAsync(Url)
							local data = HttpService:JSONDecode(response)
						end)
						if success then
							game.ReplicatedStorage.Notify:FireClient(playerInstance, "Horrah!","We demoted the user!")
						else
							game.ReplicatedStorage.Notify:FireClient(playerInstance, "Uh-Oh","We had problems demoting. the user.")
						end
					end
				end
			end
		end
	end)
end)





Have you followed what you do and set the Value?

Yes I set this values.

Can you send the youtube video link?

Have you edited any of the scripts?

No I Don’t edited any scripts

@Noah made the tutorial and idrk what the problem is. Hopefully cookie will help you.

Ok Thanks you so much

1 Like

Can we please have the heroku logs?

This is a ROBLOX issue I believe as they were dumb and made that
“Cookie expiration” update.

1 Like

Since when?

Cookies normally expire after many many years…

1 Like

There is

Happend to me too but the bot doesnt log in yes I am on incognito and then it doesn’t work when I try to login it doesnt work.

Please try run the API while keeping the logs pages open & then send the output to us in text form.

Okay, I will do so. Trying rn.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.