0% found this document useful (0 votes)
44 views3 pages

Message

Uploaded by

arturek.wojt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views3 pages

Message

Uploaded by

arturek.wojt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

local player = game.Players.

LocalPlayer
local playerGui = player.PlayerGui -- Access the PlayerGui directly
local adminGui = playerGui:WaitForChild("AdminGui")
local adminFrame = adminGui:WaitForChild("AdminFrame") -- AdminFrame inside
AdminGui
local reasonTextBox = adminFrame:WaitForChild("Reason")
local usernameTextBox = adminFrame:WaitForChild("UsernameTextBox") -- Username
input
local skipButton = adminFrame:WaitForChild("SkipIntro") -- Skip intro button
local banButton = adminFrame:WaitForChild("Ban")
local kickButton = adminFrame:WaitForChild("Kick")
local muteButton = adminFrame:WaitForChild("Mute")
local unmuteButton = adminFrame:WaitForChild("Unmute") -- Unmute button
local introGui = game.StarterGui:WaitForChild("Intro") -- Access IntroGui from
StarterGui

-- Specify the UserIds for which the Admin GUI should be visible
local adminUserIds = {1621505428} -- Replace with the UserIds you want to allow
access

-- Function to check if the player's UserId matches any in the adminUserIds list
local function isAdmin()
for _, adminId in ipairs(adminUserIds) do
if player.UserId == adminId then
return true
end
end
return false
end

-- Debugging: Print player UserId to confirm it's correct


print("Player UserId: " .. player.UserId)

-- Enable or disable AdminGui based on whether the player is an admin


if isAdmin() then
print("This player is an admin. Enabling AdminGui.")
adminGui.Enabled = true
adminGui.Visible = true -- Show AdminGui for admins
else
print("This player is NOT an admin. Disabling AdminGui.")
adminGui.Enabled = false -- Disable AdminGui for non-admins
adminGui.Visible = false -- Ensure it's not visible at all for non-admins
end

-- Skip Button for Admins to skip the intro


skipButton.MouseButton1Click:Connect(function()
print("Skip button clicked") -- Debugging to check if the event triggers
if isAdmin() then
-- Hide the intro UI when the button is clicked
introGui.Enabled = false
print("Intro skipped!") -- Debugging to confirm intro is hidden
else
print("You are not an admin.") -- Debugging message when not an admin
end
end)

-- Helper function to get the player by username


local function getPlayerByUsername(username)
for _, p in pairs(game.Players:GetPlayers()) do
if p.Name:lower() == username:lower() then
return p
end
end
return nil
end

-- Ban Button Logic


banButton.MouseButton1Click:Connect(function()
local username = usernameTextBox.Text
local reason = reasonTextBox.Text
if reason == "" then
reason = "No reason provided" -- Default reason if none is entered
end
local targetPlayer = getPlayerByUsername(username)
if targetPlayer then
-- Trigger the server to ban a player with a reason

game.ReplicatedStorage:WaitForChild("BanPlayer"):FireServer(targetPlayer,
reason)
else
warn("Player not found: " .. username)
end
end)

-- Kick Button Logic


kickButton.MouseButton1Click:Connect(function()
local username = usernameTextBox.Text
local reason = reasonTextBox.Text
if reason == "" then
reason = "No reason provided"
end
local targetPlayer = getPlayerByUsername(username)
if targetPlayer then
-- Trigger the server to kick a player with a reason

game.ReplicatedStorage:WaitForChild("KickPlayer"):FireServer(targetPlayer,
reason)
else
warn("Player not found: " .. username)
end
end)

-- Mute Button Logic


muteButton.MouseButton1Click:Connect(function()
local username = usernameTextBox.Text
local targetPlayer = getPlayerByUsername(username)
if targetPlayer then
-- Trigger the server to mute the player

game.ReplicatedStorage:WaitForChild("MutePlayer"):FireServer(targetPlayer)
else
warn("Player not found: " .. username)
end
end)

-- Unmute Button Logic


unmuteButton.MouseButton1Click:Connect(function()
local username = usernameTextBox.Text
local targetPlayer = getPlayerByUsername(username)
if targetPlayer then
-- Trigger the server to unmute the player

game.ReplicatedStorage:WaitForChild("UnmutePlayer"):FireServer(targetPlayer)
else
warn("Player not found: " .. username)
end
end)

You might also like