Advertisement
Guest User

gun game script

a guest
Aug 1st, 2022
659
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.13 KB | None | 0 0
  1. local Library = loadstring(game:HttpGet("https://raw.githubusercontent.com/xHeptc/Kavo-UI-Library/main/source.lua"))()
  2.  
  3. local Window = Library.CreateLib("Mario Gun Simulator", "GrapeTheme")
  4.  
  5. local Tab = Window:NewTab("Credit")
  6.  
  7. local Section = Tab:NewSection("Ownere")
  8.  
  9. local Section = Tab:NewSection("Mario/Winter")
  10.  
  11. local Section = Tab:NewSection("Mario sever link")
  12.  
  13. local Section = Tab:NewSection("https://discord.gg/bxN8JPEKTN")
  14.  
  15. local Section = Tab:NewSection("Co-Ownere")
  16.  
  17. local Section = Tab:NewSection("Lua")
  18.  
  19. local Section = Tab:NewSection("Lua sever link")
  20.  
  21. local Section = Tab:NewSection("https://discord.gg/d8QzEz9Nfk")
  22.  
  23. local Tab = Window:NewTab("Player")
  24.  
  25. local Section = Tab:NewSection("speed")
  26.  
  27. Section:NewSlider("walk speed", "makes you faster", 500, 0, function(s)
  28. game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = s
  29. end)
  30.  
  31. local Section = Tab:NewSection("WILL ADD MORE")
  32.  
  33. local Tab = Window:NewTab("Gun's")
  34.  
  35. local Section = Tab:NewSection("Aim bot")
  36.  
  37. Section:NewButton("Aim bot", "lock on to people", function()
  38. print("Clicked")
  39. local UIS = game:GetService("UserInputService")
  40. local camera = game.Workspace.CurrentCamera
  41. --> getting the closest player
  42. function getClosest()
  43. local closestPlayer = nil
  44. local closesDist = math.huge
  45. for i,v in pairs(game.Players:GetPlayers()) do
  46. if v ~= game.Players.LocalPlayer then
  47. local Dist = (game.Players.LocalPlayer.Character.HumanoidRootPart.Position - v.Character.HumanoidRootPart.Position).magnitude
  48. if Dist < closesDist then
  49. closesDist = Dist
  50. closestPlayer = v
  51. end
  52. end
  53. end
  54. return closestPlayer
  55. end
  56.  
  57. --> starting the aimbot
  58. _G.aim = false
  59. UIS.InputBegan:Connect(function(inp)
  60. if inp.UserInputType == Enum.UserInputType.MouseButton2 then
  61. _G.aim = true
  62. while wait() do
  63. camera.CFrame = CFrame.new(camera.CFrame.Position,getClosest().Character.Head.Position)
  64. if _G.aim == false then return end
  65. end
  66. end
  67. end)
  68. --> ending the aimbot
  69. UIS.InputEnded:Connect(function(inp)
  70. if inp.UserInputType == Enum.UserInputType.MouseButton2 then
  71. _G.aim = false
  72. end
  73. end)
  74. end)
  75.  
  76. local Section = Tab:NewSection("Aim")
  77.  
  78. Section:NewButton("Silent aim", "Silent ", function()
  79. print("Clicked")
  80. local plrs = game:GetService("Players")
  81. local plr = plrs.LocalPlayer
  82. local mouse = plr:GetMouse()
  83. local camera = game:GetService("Workspace").CurrentCamera
  84.  
  85.  
  86. function notBehindWall(target)
  87. local ray = Ray.new(plr.Character.Head.Position, (target.Position - plr.Character.Head.Position).Unit * 300)
  88. local part, position = game:GetService("Workspace"):FindPartOnRayWithIgnoreList(ray, {plr.Character}, false, true)
  89. if part then
  90. local humanoid = part.Parent:FindFirstChildOfClass("Humanoid")
  91. if not humanoid then
  92. humanoid = part.Parent.Parent:FindFirstChildOfClass("Humanoid")
  93. end
  94. if humanoid and target and humanoid.Parent == target.Parent then
  95. local pos, visible = camera:WorldToScreenPoint(target.Position)
  96. if visible then
  97. return true
  98. end
  99. end
  100. end
  101. end
  102.  
  103. function getPlayerClosestToMouse()
  104. local target = nil
  105. local maxDist = 100
  106. for _,v in pairs(plrs:GetPlayers()) do
  107. if v.Character then
  108. if v.Character:FindFirstChild("Humanoid") and v.Character.Humanoid.Health ~= 0 and v.Character:FindFirstChild("HumanoidRootPart") and v.TeamColor ~= plr.TeamColor then
  109. local pos, vis = camera:WorldToViewportPoint(v.Character.HumanoidRootPart.Position)
  110. local dist = (Vector2.new(mouse.X, mouse.Y) - Vector2.new(pos.X, pos.Y)).magnitude
  111. if dist < maxDist and vis then
  112. local torsoPos = camera:WorldToViewportPoint(v.Character.HumanoidRootPart.Position)
  113. local torsoDist = (Vector2.new(mouse.X, mouse.Y) - Vector2.new(torsoPos.X, torsoPos.Y)).magnitude
  114. local headPos = camera:WorldToViewportPoint(v.Character.Head.Position)
  115. local headDist = (Vector2.new(mouse.X, mouse.Y) - Vector2.new(headPos.X, headPos.Y)).magnitude
  116. if torsoDist > headDist then
  117. if notBehindWall(v.Character.Head) then
  118. target = v.Character.Head
  119. end
  120. else
  121. if notBehindWall(v.Character.HumanoidRootPart) then
  122. target = v.Character.HumanoidRootPart
  123. end
  124. end
  125. maxDist = dist
  126. end
  127. end
  128. end
  129. end
  130. return target
  131. end
  132.  
  133. --> Hooking to the remote <--
  134. local gmt = getrawmetatable(game)
  135. setreadonly(gmt, false)
  136. local oldNamecall = gmt.__namecall
  137.  
  138. gmt.__namecall = newcclosure(function(self, ...)
  139. local Args = {...}
  140. local method = getnamecallmethod()
  141. if tostring(self) == "HitPart" and tostring(method) == "FireServer" then
  142. Args[1] = getPlayerClosestToMouse()
  143. Args[2] = getPlayerClosestToMouse().Position
  144. return self.FireServer(self, unpack(Args))
  145. end
  146. return oldNamecall(self, ...)
  147. end)
  148. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement