Adding remote security?

Basically Im creating an admin panel and rn im scripting a kick event but obviously I don’t want exploiters being able to find the path and just fire it and kick anyone so how would I go about adding whitelisted users being able to use it?

Code:
local KickEvent = game:GetService(“ReplicatedStorage”).Events.Fixcam

KickEvent.OnServerEvent:Connect(function(player, KickPlayer)
	local PlayerKick = game.Players:FindFirstChild(KickPlayer)
	if PlayerKick then
		PlayerKick("An administrator has removed you from the game")
	end
end)
local admins = {
    [your user id] = true,
    [esc.]
}

KickEvent.OnServerEvent:Connect(function(player, KickPlayer)
	local PlayerKick = game.Players:FindFirstChild(KickPlayer)
	if admins[player.UserId] and PlayerKick then
		PlayerKick("An administrator has removed you from the game")
	end
end)
1 Like