Advertisement
ZeroParadoxes

Script for u/GlazeGage

Mar 1st, 2022
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.85 KB | None | 0 0
  1. --local script, goes in your GUI
  2. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  3.  
  4. local textbox = nil --CHANGE THIS TO YOUR TEXTBOX
  5. local AdminRe = ReplicatedStorage:WaitForChild("AdminRe")
  6.  
  7. local function onFocusLost(enterPressed, inputObject)
  8.    AdminRe:Fire(textbox.Text)
  9. end
  10.  
  11. textbox.FocusLost:Connect(onFocusLost)
  12.  
  13.  
  14. --Server Script
  15. local AdminRe = Instance.new("RemoteEvent")
  16. AdminRe.Name = "AdminRE"
  17. AdminRe.Parent = game.ReplicatedStorage
  18.  
  19. local function adminFunction(player, text)
  20.     if player.UserId = 2312544590 then --[[Its better to use UserIds instead of Names. Names can be changed, Userids cannot.
  21.         also its better to have the Server check if you're an admin as opposed to the client/localscript. A hacker could easily open the admin gui]]
  22.         if string.find(text, "/kick") then
  23.             local PlayerName = string.gsub(Message, "/kick", "")
  24.             local PlayerToKick = game.Players:FindFirstChild("PlayerName")
  25.             if PlayerToKick ~= nil then --Makes sure the Player is a valid player, in case they left the game or their name is wrong.
  26.                 PlayerToKick:Kick()
  27.                 Re7:FireAllClients
  28.            end
  29.         end
  30.     end
  31. end
  32. AdminRe.OnServerEvent:Connect(adminFunction)
  33.  
  34.  
  35. --OLD SCRIPTS:
  36. --[[The reason why is this doesn't work is that this function doesn't constantly check the gui, it only runs once and thats when the player joins]]
  37. game.Players.PlayerAdded:Connect(function(player)
  38.    If admin.Text == "/kick"..player.Name then
  39.         player.Name: Kick() Re7:FireAllClients
  40.    End
  41. End
  42.    
  43. --OLD LOCAL SCRIPT
  44.     Re7.OnClientEvent:Connect(function()
  45.             If plr(game.Players.LocalPlayet).Name == 'GlazedEntertainment' Then
  46.                 Admin.Visible = true
  47.             ElseIf plr.Name~= 'GlazedEntertainment' then
  48.                 Admin.visible = false
  49.             End
  50.     End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement