Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- YT: @darkusblox for a FULL tutorial on how to use the ban panel!!
- -- Do not edit unless you know what your're doing
- local player = game.Players.LocalPlayer
- local Players = game:GetService("Players")
- local Template = script.Parent:WaitForChild("Template")
- local playerTemp = Template:WaitForChild("PlayerTemp")
- local BanFrame = script.Parent:WaitForChild("BanFrame")
- local PlayersFrame = script.Parent:WaitForChild("PlayersFrame")
- local Button = script.Parent:WaitForChild("TextButton")
- local opened = false
- local Id_Box = BanFrame:WaitForChild("UserId")
- local Duration_Box = BanFrame:WaitForChild("Duration")
- local Reason_Box = BanFrame:WaitForChild("Reason")
- local PrivReason_Box = BanFrame:WaitForChild("PrivateReason")
- local banAltsButton = BanFrame:WaitForChild("AltAccount")
- local UniversalButton = BanFrame:WaitForChild("Universal")
- local BanButton = BanFrame:WaitForChild("BanButton")
- local UnbanButton = BanFrame:WaitForChild("UnbanButton")
- local ResultFrame = script.Parent:WaitForChild("ResultFrame")
- local ResultText = ResultFrame:WaitForChild("TextLabel")
- Button.MouseButton1Up:Connect(function()
- if opened == false then
- opened = true
- BanFrame.Visible = true
- PlayersFrame.Visible = true
- ResultFrame.Visible = true
- for _, plr in pairs(Players:GetPlayers()) do
- if plr.Name ~= player.Name then
- if not PlayersFrame:FindFirstChild(plr.Name) then
- local newPlayer = playerTemp:Clone()
- newPlayer.Name = plr.Name
- newPlayer.Parent = PlayersFrame
- print(newPlayer.Parent)
- newPlayer.ImageLabel.Image = Players:GetUserThumbnailAsync(plr.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420)
- newPlayer.Display.Text = plr.DisplayName
- newPlayer.User.Text = "@"..plr.Name
- newPlayer.Visible = true
- newPlayer.TextButton.MouseButton1Up:Connect(function()
- Id_Box.Text = plr.UserId
- end)
- end
- end
- end
- elseif opened == true then
- opened = false
- BanFrame.Visible = false
- PlayersFrame.Visible = false
- ResultFrame.Visible = false
- for _, plr in pairs(PlayersFrame:GetChildren()) do
- if not plr:IsA("UIListLayout") and not plr:IsA("UIPadding") then
- if plr then
- plr:Destroy()
- end
- end
- end
- end
- end)
- local banAlts = false
- banAltsButton.MouseButton1Up:Connect(function()
- if banAlts == false then
- banAlts = true
- banAltsButton.BackgroundColor3 = Color3.fromRGB(11, 170, 0)
- else
- banAlts = false
- banAltsButton.BackgroundColor3 = Color3.fromRGB(170, 0, 0)
- end
- end)
- local universalBan = false
- UniversalButton.MouseButton1Up:Connect(function()
- if universalBan == false then
- universalBan = true
- UniversalButton.BackgroundColor3 = Color3.fromRGB(11, 170, 0)
- else
- universalBan = false
- UniversalButton.BackgroundColor3 = Color3.fromRGB(170, 0, 0)
- end
- end)
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local banFunc = ReplicatedStorage:FindFirstChild("Ban")
- local unbanFunc = ReplicatedStorage:FindFirstChild("Unban")
- local banDebounce = false
- BanButton.MouseButton1Up:Connect(function()
- if banDebounce == false then
- banDebounce = true
- local result = banFunc:InvokeServer(tonumber(Id_Box.Text), tonumber(Duration_Box.Text), Reason_Box.Text, PrivReason_Box.Text, banAlts, universalBan)
- if result == true then
- ResultText.Text = "Player banned successfuly!"
- ResultText.TextColor3 = Color3.fromRGB(11, 170, 0)
- wait(2)
- banDebounce = false
- ResultText.Text = ""
- else
- ResultText.Text = "Error, make sure to fill in all boxes!"
- ResultText.TextColor3 = Color3.fromRGB(170, 0, 0)
- wait(2)
- banDebounce = false
- ResultText.Text = ""
- end
- end
- end)
- UnbanButton.MouseButton1Up:Connect(function()
- if banDebounce == false then
- banDebounce = true
- local result = unbanFunc:InvokeServer(tonumber(Id_Box.Text), universalBan)
- if result == true then
- ResultText.Text = "Player unbaneed successfuly!"
- ResultText.TextColor3 = Color3.fromRGB(11, 170, 0)
- wait(2)
- banDebounce = false
- ResultText.Text = ""
- else
- ResultText.Text = "Error, make sure to fill in all boxes!"
- ResultText.TextColor3 = Color3.fromRGB(170, 0, 0)
- wait(2)
- banDebounce = false
- ResultText.Text = ""
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement