How to make Hosting panel?

I have a cafe. And I want to make a hosting panel. Like if player is HR+ they can see a UI and when they click on it, a bot announces the session in our dizzy and group shout. How can I do this?

7 Likes

You can use webhooks to send messages/announcements to Discord, and you can make a localscript which checks if the player is a HR so it can show the GUI

2 Likes

To start with, make sure Http requests are on in your game. Then, make the following things:

Then, you want to fire the “Session” event when you click on the text button. The code should be:

script.Parent.MouseButton1Click:Connect(function(player)
game.ReplicatedStorage.Session:FireServer(player)
end)

Then, in your SessionScript put the following code (and change the webhookUrl variable to your webhook URL)

local webhookUrl = “YOUR WEBHOOK URL”
local http = game:GetService(“HttpService”)
game.ReplicatedStorage.Session.OnServerEvent:Connect(function(player)
local data =
{
[“content”] = “”,
[“embeds”] = {{
[“title”] = “New Session!”,
[“type”] = “rich”,
[“color”] = tonumber(0xffffff),
[“description”] = player.Name.." is hosting a session! Join now!"
}}
}
http:PostAsync(webhookUrl,http:JSONEncode(data))
end)

If you have any questions just reply to this post.

6 Likes

Thanks for your post, it helped a lot but how can I make the GUI part?

1 Like

Put the GUI in a localScript inside replicated first, name the GUI whatever and this is the script

local group = groupID
local rankID = the rank ID
game.Players.PlayerAdded:Connect(function(plr)
if plr:GetRankInGroup(group) >= rankID then
script.GUI NAME.Parent = game.Players.LocalPlayer.PlayerGUI
end)

Sorry for no formatting on a mobile device.

3 Likes

What should I do after creating webhook?
I put the script and everyting but doesnt works
It says unknown global

1 Like

Have you put the Webhook URL in quotation marks for the URL variable?

1 Like

yes, do I have to do anything more with webhook?

It errors here
[“description”] = player.Name…" is hosting a session! Join now!

In that line maybe change it to player.Name

2 Likes