Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --local script, goes in your GUI
- local ReplicatedStorage = game:GetService("ReplicatedStorage")
- local textbox = nil --CHANGE THIS TO YOUR TEXTBOX
- local AdminRe = ReplicatedStorage:WaitForChild("AdminRe")
- local function onFocusLost(enterPressed, inputObject)
- AdminRe:Fire(textbox.Text)
- end
- textbox.FocusLost:Connect(onFocusLost)
- --Server Script
- local AdminRe = Instance.new("RemoteEvent")
- AdminRe.Name = "AdminRE"
- AdminRe.Parent = game.ReplicatedStorage
- local function adminFunction(player, text)
- if player.UserId = 2312544590 then --[[Its better to use UserIds instead of Names. Names can be changed, Userids cannot.
- 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]]
- if string.find(text, "/kick") then
- local PlayerName = string.gsub(Message, "/kick", "")
- local PlayerToKick = game.Players:FindFirstChild("PlayerName")
- if PlayerToKick ~= nil then --Makes sure the Player is a valid player, in case they left the game or their name is wrong.
- PlayerToKick:Kick()
- Re7:FireAllClients
- end
- end
- end
- end
- AdminRe.OnServerEvent:Connect(adminFunction)
- --OLD SCRIPTS:
- --[[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]]
- game.Players.PlayerAdded:Connect(function(player)
- If admin.Text == "/kick"..player.Name then
- player.Name: Kick() Re7:FireAllClients
- End
- End
- --OLD LOCAL SCRIPT
- Re7.OnClientEvent:Connect(function()
- If plr(game.Players.LocalPlayet).Name == 'GlazedEntertainment' Then
- Admin.Visible = true
- ElseIf plr.Name~= 'GlazedEntertainment' then
- Admin.visible = false
- End
- End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement