How to make kick buttons for VIP Server Owners?

I want an option which appears to people who made a vip server in my game which allows them to kick people. For example, vip server creators in Jailbreak can view a small kick player UI with all the players name in game. How can I do so for my game? I just need an idea of how it is done.

lol

game has some properties related to checking if the server is a VIP server and who owns it, check out the DataModel wiki page.

Use a table as an admin list to make sure there isn’t exploitation when you do checks on the server.

I was going to say that. Just put a GUI in ServerStorage and disable it. Add a script in ServerScriptService that checks the ID of each user that joins. If the user’s id equals the owner’s id, then clone the GUI to the player gui.

Also, if you are going to do admin tabels, use IDs for that as well. Reason: you are going to find yourself doing a lot of updates each time an admin changes their name.

Hello there! You can utilize the PrivateServerOwnerId to detect whether or not a player is the owner of the VIP Server, and utilize the Kick function to achieve this. If you want to achieve this via a GUI, you would need to learn how to create gui’s, luckily there are a bunch of resources on the Developer API which you can go through and learn how to use GUI’s. Here is an introduction to creating GUI’s: Intro to GUIs

Here is some code from the PrivateServerOwnerId API in which you can extract the logic from.

local Players = game:GetService("Players")
 
-- is this a VIP server?
if game.PrivateServerId ~= "" and game.PrivateServerOwnerId ~= 0 then
    -- listen for new players being added
    Players.PlayerAdded:Connect(function(player)
        -- check if the player is the server owner
        if player.UserId == game.PrivateServerOwnerId then
            print("The private server owned has joined the game")
        end
    end)
end

Here is a quick admin script I edited, which utilizes the resources from both Developer API’s to detect the VIP Server Owner, and a simple admin kick system that the VIP Server Owner can utilize via the chat.

local Players = game:GetService("Players")
 
local kickCommand = "/kick "
 
local function onOwnerChatted(player, message)
	if message:sub(1, kickCommand:len()):lower() == kickCommand:lower() then
		local name = message:sub(kickCommand:len() + 1)
		local playerToKick = Players:FindFirstChild(name)
		if playerToKick then
			playerToKick:Kick("You have been kicked by the VIP Server owner.")
		else
			-- Couldn't find the player in question
		end
	end
end
 
local function onPlayerAdded(player)
if game.PrivateServerId ~= "" and game.PrivateServerOwnerId ~= 0 then --Detect VIP Server
	if player.UserId == game.PrivateServerOwnerId then --Detect VIP Server Owner
		player.Chatted:Connect(function (...)
			onOwnerChatted(player, ...)
		end)
	end
end
end
 
-- Listen for players being added
for _, player in pairs(Players:GetPlayers()) do
	onPlayerAdded(player)
end
Players.PlayerAdded:Connect(onPlayerAdded)
8 Likes