Kennethai

Island Royale ESP/Aimbot by Herrtt#3868

Oct 30th, 2019
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 13.65 KB | None | 0 0
  1. --[[
  2.     AimHot, made by Herrtt#3868
  3.     Press H to start the aimbot.
  4.     Press right ALT to enable ESP.
  5.     type /e -help if you need info about the aimbot/esp.
  6. --]]
  7.  
  8. _G.FRIEND_LIST = {"ROBLOX","builderman"} --Add players you want to ignore
  9.  
  10. _G.IGNORE_TEAM = true
  11. _G.START_AIMBOT = Enum.KeyCode.H
  12. _G.MAX_DIST = 5000
  13. _G.TARGET_PART = "Head"
  14.  
  15. _G.START_ESP = Enum.KeyCode.RightAlt
  16. _G.PREFIX = "/e " --If you want a space between the command and pref, you need to type a space! Ex: /ehelp . /e help
  17.  
  18.  
  19.  
  20. local startTime = tick()
  21. local AIMBOT = false
  22. local EspEnabled = false
  23.  
  24. local Players = game:GetService("Players")
  25. local StarterGui = game:GetService("StarterGui")
  26. local CoreGui = game:GetService("CoreGui")
  27. local UIS = game:GetService("UserInputService")
  28. local RunService = game:GetService("RunService")
  29.  
  30. local plr = Players.LocalPlayer
  31. local camera = workspace.CurrentCamera
  32. local mouse = plr:GetMouse()
  33. local newray = Ray.new
  34.  
  35. local function RandomCharacters(length)
  36.     local STR = ''
  37.    
  38.     for i = 1, length do
  39.         STR = STR .. string.char(math.random(65,90))
  40.     end
  41.    
  42.     return STR
  43. end
  44. local faces = {
  45.     "Back",
  46.     "Bottom",
  47.     "Front",
  48.     "Left",
  49.     "Right",
  50.     "Top"
  51. }
  52. local EspObjects = Instance.new("Folder")
  53. EspObjects.Parent = CoreGui
  54. EspObjects.Name = RandomCharacters(8)
  55.  
  56. local function SendMessage(txt,title,dur,size,color)
  57.     print(txt)
  58.     StarterGui:SetCore("ChatMakeSystemMessage",{
  59.         Text = txt,
  60.         Color = color,
  61.         FontSize = size
  62.     })
  63.     StarterGui:SetCore("SendNotification",{
  64.         Title = title,
  65.         Text = txt,
  66.         Duration = dur
  67.     })
  68. end
  69. local function ChangeColor(player, color)
  70.     if EspObjects:FindFirstChild(player) then
  71.         for i,v in pairs(EspObjects:FindFirstChild(player):GetChildren()) do
  72.             if v:IsA("SurfaceGui") then
  73.                 for _,x in pairs(v:GetChildren()) do
  74.                     if x:IsA("Frame") then
  75.                         x.BackgroundColor3 = color
  76.                     end
  77.                 end
  78.             elseif v:IsA("BillboardGui") then
  79.                 for _,x in pairs(v:GetChildren()) do
  80.                     if x:IsA("TextLabel") then
  81.                         x.TextColor = color
  82.                     end
  83.                 end
  84.             end
  85.         end
  86.     end
  87. end
  88. local function GetClosestPlayer(returnPlr,ignoreList)
  89.     ignoreList = _G.FRIEND_LIST
  90.     returnPlr = returnPlr or false
  91.    
  92.     local ignoreTeam = _G.IGNORE_TEAM
  93.     local maxdist = _G.MAX_DIST
  94.     local targetpart = _G.TARGET_PART
  95.    
  96.     if ignoreTeam == true then
  97.         if #game:GetService("Teams"):GetChildren() <= 1 then
  98.             ignoreTeam = false
  99.         end
  100.         if plr.Neutral == true then
  101.             ignoreTeam = false
  102.         end
  103.     end
  104.    
  105.     local temp1 = (maxdist)
  106.     local FoundPlr
  107.     local FoundPart
  108.    
  109.     local Table = game.Players:GetPlayers()
  110.     for _,v in pairs(Table) do
  111.         local skip = false
  112.         for _,i in pairs(ignoreList) do
  113.             if i:lower() == v.Name:lower() then
  114.                 skip = true
  115.             end
  116.         end
  117.         if ignoreTeam == true then
  118.             if v.Team == plr.Team then
  119.                 skip = true
  120.             end
  121.         end
  122.         if v.Character == nil or v.Character:FindFirstChild(targetpart) == nil then
  123.             skip = true
  124.         end
  125.  
  126.         if skip == false then
  127.             if (temp1 ~= nil and v.Character:FindFirstChild(targetpart) and plr.Character ~= nil and plr.Character:FindFirstChild(targetpart)) then
  128.                 if temp1 > (plr.Character.Head.Position - v.Character:FindFirstChild(targetpart).Position).magnitude then
  129.                     local vChar = v.Character
  130.                     if vChar:FindFirstChild("Humanoid") then
  131.                         local vHuman = vChar:FindFirstChild("Humanoid")
  132.                         if vHuman.Health > 0 then
  133.                             local dist = (plr.Character.Head.Position - vChar:FindFirstChild(targetpart).Position).magnitude
  134.                             if dist <= maxdist then
  135.                                 local ray = newray(plr.Character.Head.CFrame.p, (vChar:FindFirstChild(targetpart).CFrame.p - plr.Character.Head.CFrame.p).unit * _G.MAX_DIST)
  136.                                 local hitPart,position = workspace:FindPartOnRay(ray,plr.Character)
  137.                                    
  138.                                 if hitPart then
  139.                                     if hitPart:IsDescendantOf(vChar) then
  140.                                         temp1 = dist
  141.                                         FoundPlr = v
  142.                                         FoundPart = vChar:FindFirstChild(targetpart)
  143.                                     end
  144.                                 end
  145.                             end
  146.                         end
  147.                     end
  148.                 end
  149.             end
  150.         end
  151.     end
  152.     if returnPlr == false then
  153.         return FoundPart
  154.     elseif returnPlr == true then
  155.         return FoundPlr
  156.     end
  157. end
  158. local function CreateEspBox(pObj, color)
  159.     if (pObj:IsA("Part") and pObj.Parent:IsA("Model") and pObj.Parent ~= workspace) then
  160.         for i,v in pairs(EspObjects:GetChildren()) do
  161.             if v.Name == pObj.Parent.Name then
  162.                 return nil
  163.             end
  164.         end
  165.         local newFlder = Instance.new("Folder")
  166.         newFlder.Parent = EspObjects
  167.         newFlder.Name = pObj.Parent.Name
  168.        
  169.         for i,v in pairs(faces) do
  170.             local surfGui = Instance.new("SurfaceGui")
  171.             surfGui.AlwaysOnTop = true
  172.             surfGui.Adornee = pObj
  173.             surfGui.Face = v
  174.            
  175.             local frme = Instance.new("Frame")
  176.             frme.Size = UDim2.new(1,0,1,0)
  177.             frme.BackgroundColor3 = color
  178.             frme.BackgroundTransparency = .5
  179.             frme.BorderSizePixel = 0
  180.             frme.Parent = surfGui
  181.            
  182.             surfGui.Parent = newFlder
  183.         end
  184.         local bbGui = Instance.new("BillboardGui")
  185.         bbGui.Adornee = pObj
  186.         bbGui.Size = UDim2.new(5.5,0,1.75,0)
  187.         bbGui.ExtentsOffset = Vector3.new(0,2.5,0)
  188.         bbGui.AlwaysOnTop = true
  189.         local txtLab = Instance.new("TextLabel")
  190.         txtLab.Text = pObj.Parent.Name
  191.         txtLab.TextColor3 = color
  192.         txtLab.TextScaled = false
  193.         txtLab.TextSize = 17
  194.         txtLab.Size = UDim2.new(1,0,1,0)
  195.         txtLab.BackgroundTransparency = 1
  196.         txtLab.BorderSizePixel = 0
  197.         txtLab.Parent = bbGui
  198.         bbGui.Parent = newFlder
  199.        
  200.         local objPar = Instance.new("ObjectValue")
  201.         objPar.Value = pObj
  202.         objPar.Parent = newFlder
  203.         objPar.Name = "pObj"
  204.        
  205.         return newFlder
  206.     end
  207.     return nil
  208. end
  209. local function ClearEsp()
  210.     EspObjects:ClearAllChildren()
  211. end
  212. local function ConnectEsp(player)
  213.     local func1
  214.     local func2
  215.     if player.Character ~= nil and player.Character:FindFirstChild("Head") then
  216.         if plr.Team == nil or player.Team == nil or plr.Neutral == true or player.Neutral == true then
  217.             local fldr = CreateEspBox(player.Character:FindFirstChild("Head"), Color3.fromRGB(255,0,0))
  218.             if fldr ~= nil then
  219.                 local func3
  220.                 func3 = fldr.pObj.Changed:Connect(function()
  221.                     if fldr.pObj.Value == nil then
  222.                         if EspObjects:FindFirstChild(player.Name) then
  223.                             EspObjects:FindFirstChild(player.Name):Destroy()
  224.                         end
  225.                         func3:Disconnect()
  226.                     end
  227.                 end)
  228.             end
  229.         elseif plr.Team == player.Team then
  230.             CreateEspBox(player.Character:FindFirstChild("Head"), Color3.fromRGB(0,255,0))
  231.         elseif plr.Team ~= player.Team then
  232.             CreateEspBox(player.Character:FindFirstChild("Head"), Color3.fromRGB(255,0,0))
  233.         end
  234.     end
  235.     func1 = player.CharacterAdded:Connect(function(char)
  236.         wait(1)
  237.         if player.Character ~= nil then
  238.             func2 = player.Character:WaitForChild("Humanoid").Died:Connect(function()
  239.                 if EspObjects:FindFirstChild(player.Name) then
  240.                     EspObjects:FindFirstChild(player.Name):Destroy()
  241.                 end
  242.             end)
  243.         end
  244.         if EspEnabled == true then
  245.             if plr.Team == nil or player.Team == nil or plr.Neutral == true or player.Neutral == true then
  246.                 CreateEspBox(char:FindFirstChild("Head"), Color3.fromRGB(255,0,0))
  247.             elseif plr.Team == player.Team then
  248.                 CreateEspBox(char:FindFirstChild("Head"), Color3.fromRGB(0,255,0))
  249.             elseif plr.Team ~= player.Team then
  250.                 CreateEspBox(char:FindFirstChild("Head"), Color3.fromRGB(255,0,0))
  251.             end
  252.         else
  253.             if EspObjects:FindFirstChild(player.Name) then
  254.                 EspObjects:FindFirstChild(player.Name):Destroy()
  255.             end
  256.             func2:Disconnect()
  257.             func1:Disconnect()
  258.         end
  259.     end)
  260.     if player.Character ~= nil then
  261.         func2 = player.Character:WaitForChild("Humanoid").Died:Connect(function()
  262.             if EspObjects:FindFirstChild(player.Name) then
  263.                 EspObjects:FindFirstChild(player.Name):Destroy()
  264.             end
  265.         end)
  266.     end
  267.     return
  268. end
  269. local function EnableEsp()
  270.     if EspEnabled == true then
  271.         for i,v in pairs(Players:GetPlayers()) do
  272.             if v ~= plr then
  273.                 ConnectEsp(v)
  274.             end
  275.         end
  276.     end
  277. end
  278. Players.PlayerAdded:Connect(function(player)
  279.     if EspEnabled == true then
  280.         ConnectEsp(player)
  281.     end
  282. end)
  283. Players.PlayerRemoving:Connect(function(player)
  284.     if EspObjects:FindFirstChild(player.Name) then
  285.         EspObjects:FindFirstChild(player.Name):Destroy()
  286.     end
  287. end)
  288. UIS.InputBegan:Connect(function(KEY, gpe)
  289.     if gpe then return end;
  290.     if KEY.KeyCode == _G.START_AIMBOT then
  291.         if AIMBOT == false then
  292.             AIMBOT = true
  293.             SendMessage("Aimbot enabled.",
  294.                 "AimHot has been enabled.",
  295.                 3,
  296.                 Enum.FontSize.Size28,
  297.                 Color3.fromRGB(200,50,50)
  298.             )
  299.         elseif AIMBOT == true then
  300.             AIMBOT = false
  301.             SendMessage("Aimbot disabled.",
  302.                 "AimHot has been disabled.",
  303.                 3,
  304.                 Enum.FontSize.Size28,
  305.                 Color3.fromRGB(200,50,50)
  306.             )
  307.         end
  308.     end
  309.     if KEY.KeyCode == _G.START_ESP then
  310.         if EspEnabled == false then
  311.             SendMessage("ESP has been enabled.",
  312.                 "ESP enabled;",
  313.                 3,
  314.                 Enum.FontSize.Size28,
  315.                 Color3.fromRGB(200,50,50)
  316.             )
  317.             EspEnabled = true
  318.             EnableEsp()
  319.             while EspEnabled == true do
  320.                 ClearEsp()
  321.                 EnableEsp()
  322.                 wait(1)
  323.             end
  324.         elseif EspEnabled == true then
  325.             SendMessage("ESP has been disabled.",
  326.                 "ESP disabled;",
  327.                 3,
  328.                 Enum.FontSize.Size28,
  329.                 Color3.fromRGB(200,50,50)
  330.             )
  331.             EspEnabled = false
  332.             ClearEsp()
  333.         end
  334.     end
  335. end)
  336.  
  337. RunService.RenderStepped:Connect(function()
  338.     if (AIMBOT == true and plr.Character ~= nil and plr.Character:FindFirstChild("Humanoid") and plr.Character.Humanoid.Health > 0) then
  339.         local closestPart = GetClosestPlayer(false,{})
  340.         if closestPart ~= nil then
  341.             camera.CoordinateFrame = CFrame.new(camera.CoordinateFrame.p, closestPart.CFrame.p)
  342.             if _G.AUTO_TRIGGER == true then
  343.                 mouse1click()
  344.             end
  345.         end
  346.     end
  347. end)
  348. _G.AIMHOT_SECRETKEY = "dF10qLMn" --Not kind of secret but..
  349.  
  350. local helptxt = (
  351.         "AimHot loaded. Time taken: ".. tick()-startTime .."\n"..
  352.         "AimHot made by Herrtt#3868." .."\n"..
  353.         "   Command prefix are: "..(_G.PREFIX) .."\n"..
  354.         "   Commands are;" .."\n"..
  355.         "   <prefix>maxdist <number> (counted in studs)" .."\n"..
  356.         "   <prefix>ignoreteam <bool> (true/false)" .."\n"..
  357.         "   <prefix>targetpart <string> (Head, Torso etc.)" .."\n"..
  358.         "   <prefix>addfriend <plrname> (ROBLOX, etc.)" .."\n"..
  359.         "   <prefix>removefriend <plrname> (ROBLOX, etc.)" .."\n"..
  360.         "   <prefix>changepref <newprefix>" .."\n"..
  361.         "   <prefix>friends" .."\n"..
  362.         "   <prefix>help" .."\n"..
  363.         "   /e reset (will set all settings to regular.)" .."\n"..
  364.         "   Have fun!"
  365.         )
  366.  
  367. plr.Chatted:Connect(function(msg)
  368.     local pref = _G.PREFIX
  369.     if type(pref) ~= "string" then
  370.         print("Prefix must be a string!")
  371.     end
  372.    
  373.     if string.sub(msg,1,8+pref:len()) == pref.."maxdist " then
  374.         local maxdist = tonumber(string.sub(msg,9,msg:len()))
  375.         if type(maxdist) == "number" then
  376.             _G.MAX_DIST = maxdist
  377.             SendMessage("Changed maxdist to; "..(tostring(maxdist)),
  378.                 "Setting Changed;",
  379.                 3,
  380.                 Enum.FontSize.Size28,
  381.                 Color3.fromRGB(200,50,50)
  382.             )
  383.         end
  384.     end
  385.     if string.sub(msg,1,11+pref:len()) == pref.."ignoreteam " then
  386.         local setting = string.sub(msg,12,msg:len()):lower()
  387.         print(setting)
  388.         if setting == "true" or "false" then
  389.             _G.IGNORE_TEAM = setting
  390.            
  391.             SendMessage("Changed ignoreteam to; "..(tostring(setting)),
  392.                 "Setting Changed;",
  393.                 3,
  394.                 Enum.FontSize.Size28,
  395.                 Color3.fromRGB(200,50,50)
  396.             )
  397.         end
  398.     end
  399.     if string.sub(msg,1,11+pref:len()) == pref.."targetpart " then
  400.         local setting = string.sub(msg,12,msg:len())
  401.         if type(setting) == "string" then
  402.             _G.TARGET_PART = setting
  403.            
  404.             SendMessage("Changed targetpart to; "..(tostring(setting)),
  405.                 "Setting Changed;",
  406.                 3,
  407.                 Enum.FontSize.Size28,
  408.                 Color3.fromRGB(200,50,50)
  409.             )
  410.         end
  411.     end
  412.     if string.sub(msg,1,13+pref:len()) == pref.."removefriend " then
  413.         local setting = string.sub(msg,14,msg:len())
  414.         if type(setting) == "string" then
  415.             for i,v in pairs(_G.FRIEND_LIST) do
  416.                 if v:lower() == setting:lower() then
  417.                     table.remove(_G.FRIEND_LIST,i)
  418.                 end
  419.             end
  420.             SendMessage("Removed player from friend list; "..(tostring(setting)),
  421.                 "Friend removed;",
  422.                 3,
  423.                 Enum.FontSize.Size28,
  424.                 Color3.fromRGB(200,50,50)
  425.             )
  426.         end
  427.     end
  428.     if string.sub(msg,1,10+pref:len()) == pref.."addfriend " then
  429.         local setting = string.sub(msg,11,msg:len())
  430.         if type(setting) == "string" then
  431.             for i,v in pairs(_G.FRIEND_LIST) do
  432.                 if v == setting:lower() then
  433.                     return
  434.                 end
  435.             end
  436.             table.insert(_G.FRIEND_LIST,setting:lower())
  437.             SendMessage("Added player to friend list; "..(tostring(setting)),
  438.                 "Friend added;",
  439.                 3,
  440.                 Enum.FontSize.Size28,
  441.                 Color3.fromRGB(200,50,50)
  442.             )
  443.         end
  444.     end
  445.     if string.sub(msg,1,7+pref:len()) == pref.."friends" then
  446.         local friends = ""
  447.         for i,v in pairs(_G.FRIEND_LIST) do
  448.             if i == 1 then
  449.                 friends = v
  450.             else
  451.                 friends = friends..", "..v
  452.             end
  453.         end
  454.         SendMessage("Your friends are; " .."\n".. friends,
  455.             "Your friends;",
  456.             3,
  457.             Enum.FontSize.Size28,
  458.             Color3.fromRGB(200,50,50)
  459.         )
  460.     end
  461.     if string.sub(msg,1,11+pref:len()) == pref.."changepref " then
  462.         local setting = string.sub(msg,12+pref:len(),msg:len())
  463.         if type(setting) == "string" then
  464.             _G.PREFIX = setting
  465.             SendMessage("Changed prefix to; "..setting,
  466.                 "Setting changed;",
  467.                 3,
  468.                 Enum.FontSize.Size28,
  469.                 Color3.fromRGB(200,50,50)
  470.             )
  471.         end
  472.     end
  473.     if string.sub(msg,1,4+pref:len()) == pref.."help" then
  474.         SendMessage(helptxt,
  475.             "AimHot by Herrtt#3868;",
  476.             3,
  477.             Enum.FontSize.Size28,
  478.             Color3.fromRGB(200,50,50)
  479.         )
  480.     end
  481.     if msg == "/e reset" then
  482.         _G.FRIEND_LIST = {"ROBLOX","builderman"}
  483.  
  484.         _G.IGNORE_TEAM = true
  485.         _G.START_AIMBOT = Enum.KeyCode.H
  486.         _G.MAX_DIST = 5000
  487.         _G.TARGET_PART = "Head"
  488.         _G.PREFIX = "/e "
  489.  
  490.         SendMessage("All settings are set back to regular.",
  491.             "Settings reseted.",
  492.             Enum.FontSize.Size28,
  493.             Color3.fromRGB(200,50,50)
  494.         )
  495.     end
  496. end)
  497.  
  498. SendMessage(helptxt,
  499.     "AimHot by Herrtt#3868;",
  500.     3,
  501.     Enum.FontSize.Size28,
  502.     Color3.fromRGB(200,50,50)
  503. )
  504. _G.AIMHOT_VERSION = "4.0"
Add Comment
Please, Sign In to add comment