The_Samuelson_Studio

Kick Gui

Jun 3rd, 2022 (edited)
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.05 KB | None | 0 0
  1. -- Kick Handler Script at ServerScript--
  2.  
  3. local allowed = {"TheSamuelsonsStudio", "", ""} --Add your name
  4.  
  5. game.Players.PlayerAdded:connect(function(player)
  6.     for i, v in pairs (allowed) do
  7.         if player.Name == v then
  8.             script.KickGui:Clone().Parent = player:WaitForChild("PlayerGui")
  9.         end
  10.     end
  11. end)
  12.  
  13. game.ReplicatedStorage.KickPlayer.OnServerEvent:connect(function(player, playerToKick, reason)
  14.     game.Players:FindFirstChild(playerToKick):Kick(reason)
  15. end)
  16.  
  17.  
  18. -- Local Script at KickGui at ScreenGui--
  19.  
  20. local frame = script.Parent.Frame
  21.  
  22. script.Parent.GuiToggle.MouseButton1Click:connect(function()
  23.     if frame.Visible == true then
  24.         frame.Visible = false
  25.     else
  26.         frame.Visible = true
  27.     end
  28. end)
  29.  
  30.  
  31. frame.Cancel.MouseButton1Click:connect(function()
  32.     frame.Visible = false
  33. end)
  34.  
  35. frame.Kick.MouseButton1Click:connect(function()
  36.     if game.Players:FindFirstChild(frame.Player.Text) then
  37.         game.ReplicatedStorage.KickPlayer:FireServer(frame.Player.Text, frame.Reason.Text)
  38.     end
  39. end)
Add Comment
Please, Sign In to add comment