Advertisement
FXDuke

FXAdmin

Aug 27th, 2022 (edited)
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.79 KB | None | 0 0
  1. -- OUTDATED
  2. -- Commands
  3. -- ;tp username/displayname (teleports you)
  4. -- ;disableafk (removes afk kick)
  5. -- ;follow username/displayname (follows them)
  6. -- ;unfollow (stops following)
  7. -- ;view username/displayname (views them)
  8. -- ;unview (unviews)
  9.  
  10. -- Variables
  11. local Players = game:GetService("Players")
  12. local Player = Players.LocalPlayer
  13. local StarterGui = game:GetService("StarterGui")
  14.  
  15. -- Command Variables
  16. local follow = false
  17. local follow_subject = nil
  18.  
  19. -- Functions
  20. function findPlayer(data)
  21.     for _,v in ipairs(Players:GetChildren()) do
  22.         if string.sub(v.Name, 1, #data) == data or string.sub(string.lower(v.Name), 1, #data) == string.lower(data) and not v == Player  then
  23.             return v
  24.         elseif string.sub(v.DisplayName, 1, #data) == data or string.sub(string.lower(v.DisplayName), 1, #data) == string.lower(data) and not v == Player  then
  25.             return v
  26.         end
  27.     end
  28. end
  29.  
  30. -- Listeners
  31. Player.Chatted:Connect(function(msg)
  32.     local cmd = string.lower(msg)
  33.     if string.sub(cmd,1,4) == ";tp " then
  34.         local checkValue = findPlayer(string.sub(msg, 5))
  35.         if checkValue ~= nil then
  36.             Player.Character:FindFirstChild("HumanoidRootPart").CFrame = checkValue.Character:FindFirstChild("HumanoidRootPart").CFrame
  37.         end
  38.     elseif string.sub(cmd,1,11) == ";disableafk" then
  39.         for _,v in pairs(getconnections(game:GetService("Players").LocalPlayer.Idled)) do v:Disable() end
  40.     elseif string.sub(cmd,1,8) == ";follow " then
  41.         local checkValue = findPlayer(string.sub(msg, 9))
  42.         if checkValue ~= nil then
  43.             follow = true
  44.             follow_subject = checkValue
  45.         end
  46.     elseif string.sub(cmd,1,10) == ";unfollow" then
  47.         follow = false
  48.         follow_subject = nil
  49.     elseif string.sub(cmd,1,6) == ";view " then
  50.         local checkValue = findPlayer(string.sub(msg,7))
  51.         if checkValue ~= nil then
  52.             game:GetService("Workspace"):FindFirstChild("Camera").CameraSubject = checkValue.Character:FindFirstChild("HumanoidRootPart")
  53.         end
  54.     elseif string.sub(cmd,1,7) == ";unview" then
  55.         game:GetService("Workspace"):FindFirstChild("Camera").CameraSubject = Player.Character:FindFirstChild("Humanoid")
  56.     end
  57. end)
  58.  
  59. -- Loop
  60.  
  61. game:GetService("RunService").Heartbeat:Connect(function(dt)
  62.     if Player.Character then
  63.         if follow == true then
  64.             Player.Character:FindFirstChild("HumanoidRootPart").CFrame = follow_subject.Character:FindFirstChild("HumanoidRootPart").CFrame + follow_subject.Character:FindFirstChild("HumanoidRootPart").CFrame.LookVector * Vector3.new(-3,0,-3)
  65.         end
  66.     end
  67. end)
  68.  
  69. StarterGui:SetCore("SendNotification", {
  70.     Title = "FXAdmin",
  71.     Text = "Executed Successfully.",
  72.     Duration = 60,
  73.     Button1 = "Ok",
  74. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement