Detecting who owns the VIP Server and giving them a GUI

EDIT: Try_This.rbxl (22.4 KB)

I realised, after the remote was fired. In the OnClientEvent function there was no parameter for the Player passed in the event, and you didn’t do the server script.

This should work, i’ve tested it also

1 Like

How does a thread about detecting the owner of a private server rack up 25 replies?

A simple solution to this all is not to use the client as a verification bridge. Keep the private server management Gui in ServerStorage. On the server, check if a joining player is the private server owner by matching IDs - if they are, clone it out of ServerStorage into their PlayerGui. Then, for the actual Gui remotes, add a check that verifies the invoking client is the server owner.

local Players = game:GetService("Players")
local ServerStorage = game:GetService("ServerStorage")

local PlayerManagementGui = ServerStorage.KickGui

local SERVER_OWNER_ID = game.PrivateServerOwnerId

Players.PlayerAdded:Connect(function (Player)
    if not (SERVER_OWNER_ID == 0) and Player.UserId == SERVER_OWNER_ID then
        local PlayerGui = Player:WaitForChild("PlayerGui", 5)
        if PlayerGui then
            PlayerManagementGui:Clone().Parent = PlayerGui
        end
    end
end)

In remotes,

local SERVER_OWNER_ID = game.PrivateServerOwnerId

Event.OnServerEvent:Connect(function (player, ...)
    if player.UserId == SERVER_OWNER_ID then
        -- Other checks and code
    end
end)

Function.OnServerInvoke = function(player)
    if player.UserId == SERVER_OWNER_ID then
        -- Other checks and code
    end
    return nil -- Replace with defaults?
end

Try and be certain about what you guys suggest before posting it. Do some research and testing prior as well so you don’t end up running in circles.

4 Likes

I don’t know what method would be best and, maybe I am being over cautious. But, I would have a server script handle the awarding of the GUI.

local GUI = game:GetService("ServerStorage"):WaitForChild("NAME")

game:GetService("Players").PlayerAdded:Connect(function(plr)
        if plr.UserId == game.PrivateServerOwnerId then
               local clone = GUI:Clone()
               clone.Parent = plr:WaitForChild("PlayerGui")
        end
        return
end)

You would move it to Server Storage because only the server would be accessing it anyways. Also, if it is stored in Replicated Storage could an exploiter clone it to they’re Player Gui? You should never trust the client. So it is best to keep it server sided. Just to avoid any potential exploits. Remote events are unsecure. Even though you would do a server sided check, this method would cut down on unnecessary client-server communication. Reducing potential lag, it is easier to make, and it is just simpler. :smiley:

The OP mentioned that this GUI will be used for kicking, which would have to be handled by a remote event. I think it’s acceptable to keep the GUI on the client, and run the checks on the server.

That does make sense either way would work. Using on the client would have to have more remote events or functions. But I guess it’s just down to preference. As long as your doing good server sided checks it shouldn’t matter.

The GUI is already developed, also I lost track of this post and I need to attempt to fix it using code suggested here.

Sorry to bump this thread, but I found a script from the Developer Hub, and modified it a bit for your liking.

Original Script:

local Players = game:GetService("Players")
local PrivateServerOwnerGUI = game.StarterGui.TestingScreenGUI.Frame --Replace this with your own ScreenGui

if game.PrivateServerId ~= "" and game.PrivateServerOwnerId ~= 0 then
	Players.PlayerAdded:Connect(function(player)
		if player.UserId == game.PrivateServerOwnerId then
			print("The private server owner has joined the game!")
			PrivateServerOwnerGUI.Frame.Visible = true
			print("GUI has been made visible!")
		end
	end)
end
2 Likes