Advertisement
vtrvsted

Reach script

Aug 16th, 2021
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.69 KB | None | 0 0
  1. local active = true
  2. local trueActive = true
  3. local reachType = "Sphere"
  4. local dmgEnabled = true
  5. local visualizerEnabled = false
  6.  
  7. local visualizer = Instance.new("Part")
  8. visualizer.BrickColor = BrickColor.Blue()
  9. visualizer.Transparency = 0.6
  10. visualizer.Anchored = true
  11. visualizer.CanCollide = false
  12. visualizer.Size = Vector3.new(0.5,0.5,0.5)
  13. visualizer.BottomSurface = Enum.SurfaceType.Smooth
  14. visualizer.TopSurface = Enum.SurfaceType.Smooth
  15.  
  16. local ScreenGui = Instance.new("ScreenGui")
  17. local Frame = Instance.new("Frame")
  18. local TextLabel = Instance.new("TextLabel")
  19. local TextBox = Instance.new("TextBox")
  20. local TextLabel_2 = Instance.new("TextLabel")
  21. local TextLabel_3 = Instance.new("TextLabel")
  22. local TextLabel_4 = Instance.new("TextLabel")
  23. local TextButton = Instance.new("TextButton")
  24. local Frame_2 = Instance.new("Frame")
  25. local Frame_3 = Instance.new("Frame")
  26. local Frame_4 = Instance.new("Frame")
  27. local Frame_5 = Instance.new("Frame")
  28. local TextButton_2 = Instance.new("TextButton")
  29.  
  30. --Properties:
  31.  
  32. ScreenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
  33. ScreenGui.DisplayOrder = 999999999
  34. ScreenGui.ResetOnSpawn = false
  35.  
  36. Frame.Parent = ScreenGui
  37. Frame.AnchorPoint = Vector2.new(0, 0.5)
  38. Frame.BackgroundColor3 = Color3.fromRGB(45, 45, 45)
  39. Frame.BackgroundTransparency = 0.300
  40. Frame.BorderColor3 = Color3.fromRGB(0, 0, 0)
  41. Frame.BorderSizePixel = 4
  42. Frame.Position = UDim2.new(0, 0, 0.600000024, 0)
  43. Frame.Size = UDim2.new(0.150000006, 0, 0.300000012, 0)
  44.  
  45. TextLabel.Parent = Frame
  46. TextLabel.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  47. TextLabel.BackgroundTransparency = 1.000
  48. TextLabel.Size = UDim2.new(0.600000024, 0, 0.200000003, 0)
  49. TextLabel.Font = Enum.Font.SourceSans
  50. TextLabel.Text = "Reach:"
  51. TextLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
  52. TextLabel.TextScaled = true
  53. TextLabel.TextSize = 14.000
  54. TextLabel.TextWrapped = true
  55.  
  56. TextBox.Parent = Frame
  57. TextBox.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  58. TextBox.BackgroundTransparency = 1.000
  59. TextBox.Position = UDim2.new(0.600000024, 0, 0, 0)
  60. TextBox.Size = UDim2.new(0.400000006, 0, 0.200000003, 0)
  61. TextBox.Font = Enum.Font.SourceSans
  62. TextBox.Text = "3.5"
  63. TextBox.TextColor3 = Color3.fromRGB(255, 76, 76)
  64. TextBox.TextScaled = true
  65. TextBox.TextSize = 14.000
  66. TextBox.TextWrapped = true
  67.  
  68. TextLabel_2.Parent = Frame
  69. TextLabel_2.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  70. TextLabel_2.BackgroundTransparency = 1.000
  71. TextLabel_2.Position = UDim2.new(0, 0, 0.200000003, 0)
  72. TextLabel_2.Size = UDim2.new(0.600000024, 0, 0.200000003, 0)
  73. TextLabel_2.Font = Enum.Font.SourceSans
  74. TextLabel_2.Text = "Shape:"
  75. TextLabel_2.TextColor3 = Color3.fromRGB(255, 255, 255)
  76. TextLabel_2.TextScaled = true
  77. TextLabel_2.TextSize = 14.000
  78. TextLabel_2.TextWrapped = true
  79.  
  80. TextLabel_3.Parent = Frame
  81. TextLabel_3.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  82. TextLabel_3.BackgroundTransparency = 1.000
  83. TextLabel_3.Position = UDim2.new(0, 0, 0.400000006, 0)
  84. TextLabel_3.Size = UDim2.new(0.600000024, 0, 0.200000003, 0)
  85. TextLabel_3.Font = Enum.Font.SourceSans
  86. TextLabel_3.Text = "Damage:"
  87. TextLabel_3.TextColor3 = Color3.fromRGB(255, 255, 255)
  88. TextLabel_3.TextScaled = true
  89. TextLabel_3.TextSize = 14.000
  90. TextLabel_3.TextWrapped = true
  91.  
  92. TextLabel_4.Parent = Frame
  93. TextLabel_4.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  94. TextLabel_4.BackgroundTransparency = 1.000
  95. TextLabel_4.Position = UDim2.new(0, 0, 0.600000024, 0)
  96. TextLabel_4.Size = UDim2.new(0.600000024, 0, 0.200000003, 0)
  97. TextLabel_4.Font = Enum.Font.SourceSans
  98. TextLabel_4.Text = "Visualizer:"
  99. TextLabel_4.TextColor3 = Color3.fromRGB(255, 255, 255)
  100. TextLabel_4.TextScaled = true
  101. TextLabel_4.TextSize = 14.000
  102. TextLabel_4.TextWrapped = true
  103.  
  104. TextButton.Parent = Frame
  105. TextButton.AnchorPoint = Vector2.new(0, 1)
  106. TextButton.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  107. TextButton.BackgroundTransparency = 1.000
  108. TextButton.Position = UDim2.new(0, 0, 1, 0)
  109. TextButton.Size = UDim2.new(1, 0, 0.150000006, 0)
  110. TextButton.Font = Enum.Font.SourceSansBold
  111. TextButton.Text = "Kill Script"
  112. TextButton.TextColor3 = Color3.fromRGB(222, 0, 0)
  113. TextButton.TextScaled = true
  114. TextButton.TextSize = 14.000
  115. TextButton.TextWrapped = true
  116.  
  117. Frame_2.Parent = Frame
  118. Frame_2.Active = true
  119. Frame_2.AnchorPoint = Vector2.new(0, 0.5)
  120. Frame_2.BackgroundColor3 = Color3.fromRGB(31, 31, 31)
  121. Frame_2.BorderSizePixel = 0
  122. Frame_2.Position = UDim2.new(0.725000024, 0, 0.699999988, 0)
  123. Frame_2.Size = UDim2.new(0, 25, 0, 25)
  124. Frame_2.ZIndex = 5
  125.  
  126. Frame_3.Parent = Frame_2
  127. Frame_3.AnchorPoint = Vector2.new(0.5, 0.5)
  128. Frame_3.BackgroundColor3 = Color3.fromRGB(255, 76, 76)
  129. Frame_3.BorderSizePixel = 0
  130. Frame_3.LayoutOrder = 1
  131. Frame_3.Position = UDim2.new(0.5, 0, 0.5, 0)
  132.  
  133. Frame_4.Parent = Frame
  134. Frame_4.Active = true
  135. Frame_4.AnchorPoint = Vector2.new(0, 0.5)
  136. Frame_4.BackgroundColor3 = Color3.fromRGB(31, 31, 31)
  137. Frame_4.BorderSizePixel = 0
  138. Frame_4.Position = UDim2.new(0.725000024, 0, 0.5, 0)
  139. Frame_4.Size = UDim2.new(0, 25, 0, 25)
  140. Frame_4.ZIndex = 5
  141.  
  142. Frame_5.Parent = Frame_4
  143. Frame_5.AnchorPoint = Vector2.new(0.5, 0.5)
  144. Frame_5.BackgroundColor3 = Color3.fromRGB(255, 76, 76)
  145. Frame_5.BorderSizePixel = 0
  146. Frame_5.LayoutOrder = 1
  147. Frame_5.Position = UDim2.new(0.5, 0, 0.5, 0)
  148. Frame_5.Size = UDim2.new(1, 0, 1, 0)
  149.  
  150. TextButton_2.Parent = Frame
  151. TextButton_2.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  152. TextButton_2.BackgroundTransparency = 1.000
  153. TextButton_2.Position = UDim2.new(0.600000024, 0, 0.200000003, 0)
  154. TextButton_2.Size = UDim2.new(0.400000006, 0, 0.200000003, 0)
  155. TextButton_2.Font = Enum.Font.SourceSans
  156. TextButton_2.Text = "Sphere"
  157. TextButton_2.TextColor3 = Color3.fromRGB(255, 76, 76)
  158. TextButton_2.TextScaled = true
  159. TextButton_2.TextSize = 14.000
  160. TextButton_2.TextWrapped = true
  161.  
  162. repeat wait() until game.Players.LocalPlayer
  163. ScreenGui.Parent = game:GetService("CoreGui")
  164.  
  165.  
  166.  
  167. Frame_4.InputBegan:connect(function(inp)
  168. if inp.UserInputType == Enum.UserInputType.MouseButton1 then
  169. dmgEnabled = not dmgEnabled
  170. local goal = {Size = UDim2.new(0,0,0,0)}
  171. if dmgEnabled then
  172. goal = {Size = UDim2.new(1,0,1,0)}
  173. end
  174. game:GetService("TweenService"):Create(Frame_5,TweenInfo.new(0.12,Enum.EasingStyle.Quad),goal):Play()
  175. end
  176. end)
  177. Frame_2.InputBegan:connect(function(inp)
  178. if inp.UserInputType == Enum.UserInputType.MouseButton1 then
  179. visualizerEnabled = not visualizerEnabled
  180. local goal = {Size = UDim2.new(0,0,0,0)}
  181. if visualizerEnabled then
  182. goal = {Size = UDim2.new(1,0,1,0)}
  183. end
  184. game:GetService("TweenService"):Create(Frame_3,TweenInfo.new(0.12,Enum.EasingStyle.Linear),goal):Play()
  185. end
  186. end)
  187. TextButton_2.MouseButton1Click:connect(function()
  188. if reachType == "Sphere" then
  189. reachType = "Line"
  190. else
  191. reachType = "Sphere"
  192. end
  193. TextButton_2.Text = reachType
  194. end)
  195. TextButton.MouseButton1Click:connect(function()
  196. trueActive = false
  197. ScreenGui:Destroy()
  198. end)
  199. game:GetService("UserInputService").InputBegan:connect(function(inp,gpe)
  200. if gpe then return end
  201. if inp.KeyCode == Enum.KeyCode.H then
  202. ScreenGui.Enabled = not ScreenGui.Enabled
  203. end
  204. end)
  205.  
  206. local plr = game.Players.LocalPlayer
  207.  
  208. local function onHit(hit,handle)
  209. local victim = hit.Parent:FindFirstChildOfClass("Humanoid")
  210. if victim and victim.Parent.Name ~= game.Players.LocalPlayer.Name then
  211. if dmgEnabled then
  212. for _,v in pairs(hit.Parent:GetChildren()) do
  213. if v:IsA("Part") then
  214. firetouchinterest(v,handle,0)
  215. firetouchinterest(v,handle,1)
  216. end
  217. end
  218. else
  219. firetouchinterest(hit,handle,0)
  220. firetouchinterest(hit,handle,1)
  221. end
  222. end
  223. end
  224.  
  225. local function getWhiteList()
  226. local wl = {}
  227. for _,v in pairs(game.Players:GetPlayers()) do
  228. if v ~= plr then
  229. local char = v.Character
  230. if char then
  231. for _,q in pairs(char:GetChildren()) do
  232. if q:IsA("Part") then
  233. table.insert(wl,q)
  234. end
  235. end
  236. end
  237. end
  238. end
  239. return wl
  240. end
  241.  
  242. game:GetService("RunService").RenderStepped:connect(function()
  243. if not active or not trueActive then return end
  244. local s = plr.Character and plr.Character:FindFirstChildOfClass("Tool")
  245. if not s then visualizer.Parent = nil end
  246. if s then
  247. local handle = s:FindFirstChild("Handle") or s:FindFirstChildOfClass("Part")
  248. if handle then
  249. if visualizerEnabled then
  250. visualizer.Parent = workspace
  251. else
  252. visualizer.Parent = nil
  253. end
  254. local reach = tonumber(TextBox.Text)
  255. if reach then
  256. if reachType == "Sphere" then
  257. visualizer.Shape = Enum.PartType.Ball
  258. visualizer.Size = Vector3.new(reach,reach,reach)
  259. visualizer.CFrame = handle.CFrame
  260. for _,v in pairs(game.Players:GetPlayers()) do
  261. local hrp = v.Character and v.Character:FindFirstChild("HumanoidRootPart")
  262. if hrp and handle then
  263. local mag = (hrp.Position-handle.Position).magnitude
  264. if mag <= reach then
  265. onHit(hrp,handle)
  266. end
  267. end
  268. end
  269. elseif reachType == "Line" then
  270. local origin = (handle.CFrame*CFrame.new(0,0,-2)).p
  271. local ray = Ray.new(origin,handle.CFrame.lookVector*-reach)
  272. local p,pos = workspace:FindPartOnRayWithWhitelist(ray,getWhiteList())
  273. visualizer.Shape = Enum.PartType.Block
  274. visualizer.Size = Vector3.new(1,0.8,reach)
  275. visualizer.CFrame = handle.CFrame*CFrame.new(0,0,(reach/2)+2)
  276. if p then
  277. onHit(p,handle)
  278. else
  279. for _,v in pairs(handle:GetTouchingParts()) do
  280. onHit(v,handle)
  281. end
  282. end
  283. end
  284. end
  285. end
  286. end
  287. end)
  288.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement