Advertisement
waconline

Physic gun

Feb 20th, 2020
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --https://github.com/Mokiros/roblox-FE-compatibility
  2. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  3. local Player,game,owner = owner,game
  4. local RealPlayer = Player
  5. do
  6. print("FE Compatibility code V2 by Mokiros")
  7. local RealPlayer = RealPlayer
  8. script.Parent = RealPlayer.Character
  9.  
  10. --Fake event to make stuff like Mouse.KeyDown work
  11. local Disconnect_Function = function(this)
  12. this[1].Functions[this[2]] = nil
  13. end
  14. local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
  15. local FakeEvent_Metatable = {__index={
  16. Connect = function(this,f)
  17. local i = tostring(math.random(0,10000))
  18. while this.Functions[i] do
  19. i = tostring(math.random(0,10000))
  20. end
  21. this.Functions[i] = f
  22. return setmetatable({this,i},Disconnect_Metatable)
  23. end
  24. }}
  25. FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
  26. local function fakeEvent()
  27. return setmetatable({Functions={}},FakeEvent_Metatable)
  28. end
  29.  
  30. --Creating fake input objects with fake variables
  31. local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
  32. FakeMouse.keyUp = FakeMouse.KeyUp
  33. FakeMouse.keyDown = FakeMouse.KeyDown
  34. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  35. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  36. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  37. end}
  38. --Merged 2 functions into one by checking amount of arguments
  39. CAS.UnbindAction = CAS.BindAction
  40.  
  41. --This function will trigger the events that have been :Connect()'ed
  42. local function TriggerEvent(self,ev,...)
  43. for _,f in pairs(self[ev].Functions) do
  44. f(...)
  45. end
  46. end
  47. FakeMouse.TriggerEvent = TriggerEvent
  48. UIS.TriggerEvent = TriggerEvent
  49.  
  50. --Client communication
  51. local Event = Instance.new("RemoteEvent")
  52. Event.Name = "UserInput_Event"
  53. Event.OnServerEvent:Connect(function(plr,io)
  54. if plr~=RealPlayer then return end
  55. FakeMouse.Target = io.Target
  56. FakeMouse.Hit = io.Hit
  57. if not io.isMouse then
  58. local b = io.UserInputState == Enum.UserInputState.Begin
  59. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  60. return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
  61. end
  62. if io.UserInputType == Enum.UserInputType.MouseButton2 then
  63. return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
  64. end
  65. for _,t in pairs(CAS.Actions) do
  66. for _,k in pairs(t.Keys) do
  67. if k==io.KeyCode then
  68. t.Function(t.Name,io.UserInputState,io)
  69. end
  70. end
  71. end
  72. FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  73. UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
  74. end
  75. end)
  76. Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
  77. local Mouse = owner:GetMouse()
  78. local UIS = game:GetService("UserInputService")
  79. local input = function(io,RobloxHandled)
  80. if RobloxHandled then return end
  81. --Since InputObject is a client-side instance, we create and pass table instead
  82. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  83. end
  84. UIS.InputBegan:Connect(input)
  85. UIS.InputEnded:Connect(input)
  86.  
  87. local h,t
  88. --Give the server mouse data every second frame, but only if the values changed
  89. --If player is not moving their mouse, client won't fire events
  90. local HB = game:GetService("RunService").Heartbeat
  91. while true do
  92. if h~=Mouse.Hit or t~=Mouse.Target then
  93. h,t=Mouse.Hit,Mouse.Target
  94. Event:FireServer({isMouse=true,Target=t,Hit=h})
  95. end
  96. --Wait 2 frames
  97. for i=1,2 do
  98. HB:Wait()
  99. end
  100. end]==],script)
  101.  
  102. ----Sandboxed game object that allows the usage of client-side methods and services
  103. --Real game object
  104. local RealGame = game
  105.  
  106. --Metatable for fake service
  107. local FakeService_Metatable = {
  108. __index = function(self,k)
  109. local s = rawget(self,"_RealService")
  110. if s then
  111. return typeof(s[k])=="function"
  112. and function(_,...)return s[k](s,...)end or s[k]
  113. end
  114. end,
  115. __newindex = function(self,k,v)
  116. local s = rawget(self,"_RealService")
  117. if s then s[k]=v end
  118. end
  119. }
  120. local function FakeService(t,RealService)
  121. t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
  122. return setmetatable(t,FakeService_Metatable)
  123. end
  124.  
  125. --Fake game object
  126. local FakeGame = {
  127. GetService = function(self,s)
  128. return rawget(self,s) or RealGame:GetService(s)
  129. end,
  130. Players = FakeService({
  131. LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
  132. },"Players"),
  133. UserInputService = FakeService(UIS,"UserInputService"),
  134. ContextActionService = FakeService(CAS,"ContextActionService"),
  135. RunService = FakeService({
  136. _btrs = {},
  137. RenderStepped = RealGame:GetService("RunService").Heartbeat,
  138. BindToRenderStep = function(self,name,_,fun)
  139. self._btrs[name] = self.Heartbeat:Connect(fun)
  140. end,
  141. UnbindFromRenderStep = function(self,name)
  142. self._btrs[name]:Disconnect()
  143. end,
  144. },"RunService")
  145. }
  146. rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
  147. FakeGame.service = FakeGame.GetService
  148. FakeService(FakeGame,game)
  149. --Changing owner to fake player object to support owner:GetMouse()
  150. game,owner = FakeGame,FakeGame.Players.LocalPlayer
  151. end
  152. --Physics gun
  153. function sandbox(var,func)
  154. local env = getfenv(func)
  155. local newenv = setmetatable({},{
  156. __index = function(self,k)
  157. if k=="script" then
  158. return var
  159. else
  160. return env[k]
  161. end
  162. end,
  163. })
  164. setfenv(func,newenv)
  165. return func
  166. end
  167. cors = {}
  168. mas = Instance.new("Model",game:GetService("Lighting"))
  169. Tool0 = Instance.new("Tool")
  170. Part1 = Instance.new("Part")
  171. CylinderMesh2 = Instance.new("CylinderMesh")
  172. Part3 = Instance.new("Part")
  173. LocalScript4 = Instance.new("LocalScript")
  174. Script5 = Instance.new("Script")
  175. LocalScript6 = Instance.new("LocalScript")
  176. Script7 = Instance.new("Script")
  177. LocalScript8 = Instance.new("LocalScript")
  178. Part9 = Instance.new("Part")
  179. Script10 = Instance.new("Script")
  180. Part11 = Instance.new("Part")
  181. Script12 = Instance.new("Script")
  182. Part13 = Instance.new("Part")
  183. Script14 = Instance.new("Script")
  184. Tool0.Name = "Physics Gun"
  185. Tool0.Parent = mas
  186. Tool0.CanBeDropped = false
  187. Part1.Name = "Handle"
  188. Part1.Parent = Tool0
  189. Part1.Material = Enum.Material.Neon
  190. Part1.BrickColor = BrickColor.new("Cyan")
  191. Part1.Transparency = 1
  192. Part1.Rotation = Vector3.new(0, 15.4200001, 0)
  193. Part1.CanCollide = false
  194. Part1.FormFactor = Enum.FormFactor.Custom
  195. Part1.Size = Vector3.new(1, 0.400000036, 0.300000012)
  196. Part1.CFrame = CFrame.new(-55.2695465, 0.696546972, 0.383156985, 0.96399641, -4.98074878e-05, 0.265921414, 4.79998416e-05, 1, 1.32960558e-05, -0.265921414, -5.30653779e-08, 0.96399641)
  197. Part1.BottomSurface = Enum.SurfaceType.Smooth
  198. Part1.TopSurface = Enum.SurfaceType.Smooth
  199. Part1.Color = Color3.new(0.0156863, 0.686275, 0.92549)
  200. Part1.Position = Vector3.new(-55.2695465, 0.696546972, 0.383156985)
  201. Part1.Orientation = Vector3.new(0, 15.4200001, 0)
  202. Part1.Color = Color3.new(0.0156863, 0.686275, 0.92549)
  203. CylinderMesh2.Parent = Part1
  204. CylinderMesh2.Scale = Vector3.new(0.100000001, 0.100000001, 0.100000001)
  205. CylinderMesh2.Scale = Vector3.new(0.100000001, 0.100000001, 0.100000001)
  206. Part3.Name = "Shoot"
  207. Part3.Parent = Tool0
  208. Part3.Material = Enum.Material.Neon
  209. Part3.BrickColor = BrickColor.new("Cyan")
  210. Part3.Reflectance = 0.30000001192093
  211. Part3.Transparency = 1
  212. Part3.Rotation = Vector3.new(90.9799957, 0.25999999, -91.409996)
  213. Part3.CanCollide = false
  214. Part3.FormFactor = Enum.FormFactor.Custom
  215. Part3.Size = Vector3.new(0.200000003, 0.25, 0.310000032)
  216. Part3.CFrame = CFrame.new(-54.7998123, 0.774299085, -0.757350147, -0.0245519895, 0.99968797, 0.00460194098, 0.0169109926, 0.00501798885, -0.999844491, -0.999555528, -0.0244703442, -0.0170289185)
  217. Part3.BottomSurface = Enum.SurfaceType.Smooth
  218. Part3.TopSurface = Enum.SurfaceType.Smooth
  219. Part3.Color = Color3.new(0.0156863, 0.686275, 0.92549)
  220. Part3.Position = Vector3.new(-54.7998123, 0.774299085, -0.757350147)
  221. Part3.Orientation = Vector3.new(88.9899979, 164.87999, 73.4700012)
  222. Part3.Color = Color3.new(0.0156863, 0.686275, 0.92549)
  223. LocalScript4.Parent = Tool0
  224. table.insert(cors,sandbox(LocalScript4,function()
  225. -- Variables for services
  226. local render = game:GetService("RunService").RenderStepped
  227. local contextActionService = game:GetService("ContextActionService")
  228. local userInputService = game:GetService("UserInputService")
  229.  
  230. local player = game.Players.LocalPlayer
  231. local mouse = player:GetMouse()
  232. local Tool = script.Parent
  233.  
  234. -- Variables for Module Scripts
  235. local screenSpace = require(Tool:WaitForChild("ScreenSpace"))
  236.  
  237. local connection
  238. -- Variables for character joints
  239.  
  240. local neck, shoulder, oldNeckC0, oldShoulderC0
  241.  
  242. local mobileShouldTrack = true
  243.  
  244. -- Thourough check to see if a character is sitting
  245. local function amISitting(character)
  246. local t = character.Torso
  247. for _, part in pairs(t:GetConnectedParts(true)) do
  248. if part:IsA("Seat") or part:IsA("VehicleSeat") then
  249. return true
  250. end
  251. end
  252. end
  253.  
  254. -- Function to call on renderstepped. Orients the character so it is facing towards
  255. -- the player mouse's position in world space. If character is sitting then the torso
  256. -- should not track
  257. local function frame(mousePosition)
  258. -- Special mobile consideration. We don't want to track if the user was touching a ui
  259. -- element such as the movement controls. Just return out of function if so to make sure
  260. -- character doesn't track
  261. if not mobileShouldTrack then return end
  262.  
  263. -- Make sure character isn't swiming. If the character is swimming the following code will
  264. -- not work well; the character will not swim correctly. Besides, who shoots underwater?
  265. if player.Character.Humanoid:GetState() ~= Enum.HumanoidStateType.Swimming then
  266. local torso = player.Character.Torso
  267. local head = player.Character.Head
  268.  
  269. local toMouse = (mousePosition - head.Position).unit
  270. local angle = math.acos(toMouse:Dot(Vector3.new(0,1,0)))
  271.  
  272. local neckAngle = angle
  273.  
  274. -- Limit how much the head can tilt down. Too far and the head looks unnatural
  275. if math.deg(neckAngle) > 110 then
  276. neckAngle = math.rad(110)
  277. end
  278. neck.C0 = CFrame.new(0,1,0) * CFrame.Angles(math.pi - neckAngle,math.pi,0)
  279.  
  280. -- Calculate horizontal rotation
  281. local arm = player.Character:FindFirstChild("Right Arm")
  282. local fromArmPos = torso.Position + torso.CFrame:vectorToWorldSpace(Vector3.new(
  283. torso.Size.X/2 + arm.Size.X/2, torso.Size.Y/2 - arm.Size.Z/2, 0))
  284. local toMouseArm = ((mousePosition - fromArmPos) * Vector3.new(1,0,1)).unit
  285. local look = (torso.CFrame.lookVector * Vector3.new(1,0,1)).unit
  286. local lateralAngle = math.acos(toMouseArm:Dot(look))
  287.  
  288. -- Check for rogue math
  289. if tostring(lateralAngle) == "-1.#IND" then
  290. lateralAngle = 0
  291. end
  292.  
  293. -- Handle case where character is sitting down
  294. if player.Character.Humanoid:GetState() == Enum.HumanoidStateType.Seated then
  295.  
  296. local cross = torso.CFrame.lookVector:Cross(toMouseArm)
  297. if lateralAngle > math.pi/2 then
  298. lateralAngle = math.pi/2
  299. end
  300. if cross.Y < 0 then
  301. lateralAngle = -lateralAngle
  302. end
  303. end
  304.  
  305. -- Turn shoulder to point to mouse
  306. shoulder.C0 = CFrame.new(1,0.5,0) * CFrame.Angles(math.pi/2 - angle,math.pi/2 + lateralAngle,0)
  307.  
  308. -- If not sitting then aim torso laterally towards mouse
  309. if not amISitting(player.Character) then
  310. torso.CFrame = CFrame.new(torso.Position, torso.Position + (Vector3.new(
  311. mousePosition.X, torso.Position.Y, mousePosition.Z)-torso.Position).unit)
  312. else
  313. --print("sitting")
  314. end
  315. end
  316. end
  317.  
  318. -- Function to bind to render stepped if player is on PC
  319. local function pcFrame()
  320. frame(mouse.Hit.p)
  321. end
  322.  
  323. -- Function to bind to touch moved if player is on mobile
  324. local function mobileFrame(touch, processed)
  325. -- Check to see if the touch was on a UI element. If so, we don't want to update anything
  326. if not processed then
  327. -- Calculate touch position in world space. Uses Stravant's ScreenSpace Module script
  328. -- to create a ray from the camera.
  329. local test = screenSpace.ScreenToWorld(touch.Position.X, touch.Position.Y, 1)
  330. local nearPos = game.Workspace.CurrentCamera.CoordinateFrame:vectorToWorldSpace(screenSpace.ScreenToWorld(touch.Position.X, touch.Position.Y, 1))
  331. nearPos = game.Workspace.CurrentCamera.CoordinateFrame.p - nearPos
  332. local farPos = screenSpace.ScreenToWorld(touch.Position.X, touch.Position.Y,50)
  333. farPos = game.Workspace.CurrentCamera.CoordinateFrame:vectorToWorldSpace(farPos) * -1
  334. if farPos.magnitude > 900 then
  335. farPos = farPos.unit * 900
  336. end
  337. local ray = Ray.new(nearPos, farPos)
  338. local part, pos = game.Workspace:FindPartOnRay(ray, player.Character)
  339.  
  340. -- if a position was found on the ray then update the character's rotation
  341. if pos then
  342. frame(pos)
  343. end
  344. end
  345. end
  346.  
  347. local oldIcon = nil
  348. -- Function to bind to equip event
  349. local function equip()
  350. local torso = player.Character.Torso
  351.  
  352. -- Setup joint variables
  353. neck = torso.Neck
  354. oldNeckC0 = neck.C0
  355. shoulder = torso:FindFirstChild("Right Shoulder")
  356. oldShoulderC0 = shoulder.C0
  357.  
  358. -- Remember old mouse icon and update current
  359. oldIcon = mouse.Icon
  360. mouse.Icon = "rbxassetid:// 509381906"
  361.  
  362. -- Bind TouchMoved event if on mobile. Otherwise connect to renderstepped
  363. if userInputService.TouchEnabled then
  364. connection = userInputService.TouchMoved:connect(mobileFrame)
  365. else
  366. connection = render:connect(pcFrame)
  367. end
  368.  
  369. -- Bind TouchStarted and TouchEnded. Used to determine if character should rotate
  370. -- during touch input
  371. userInputService.TouchStarted:connect(function(touch, processed)
  372. mobileShouldTrack = not processed
  373. end)
  374. userInputService.TouchEnded:connect(function(touch, processed)
  375. mobileShouldTrack = false
  376. end)
  377.  
  378. -- Fire server's equip event
  379. game.ReplicatedStorage.ROBLOX_PistolEquipEvent:FireServer()
  380.  
  381. -- Bind event for when mouse is clicked to fire server's fire event
  382. mouse.Button1Down:connect(function()
  383. game.ReplicatedStorage.ROBLOX_PistolFireEvent:FireServer(mouse.Hit.p)
  384. end)
  385.  
  386. -- Bind reload event to mobile button and r key
  387. contextActionService:BindActionToInputTypes("Reload", function()
  388. game.ReplicatedStorage.ROBLOX_PistolReloadEvent:FireServer()
  389. end, true, "")
  390.  
  391. -- If game uses filtering enabled then need to update server while tool is
  392. -- held by character.
  393. if workspace.FilteringEnabled then
  394. while connection do
  395. wait()
  396. game.ReplicatedStorage.ROBLOX_PistolUpdateEvent:FireServer(neck.C0, shoulder.C0)
  397. end
  398. end
  399. end
  400.  
  401. -- Function to bind to Unequip event
  402. local function unequip()
  403. if connection then connection:disconnect() end
  404. contextActionService:UnbindAction("Reload")
  405. game.ReplicatedStorage.ROBLOX_PistolUnequipEvent:FireServer()
  406. mouse.Icon = oldIcon
  407. neck.C0 = oldNeckC0
  408. shoulder.C0 = oldShoulderC0
  409. end
  410.  
  411. -- Bind tool events
  412. Tool.Equipped:connect(equip)
  413. Tool.Unequipped:connect(unequip)
  414. end))
  415. Script5.Name = "qPerfectionWeld"
  416. Script5.Parent = Tool0
  417. table.insert(cors,sandbox(Script5,function()
  418. -- Created by Quenty (@Quenty, follow me on twitter).
  419. -- Should work with only ONE copy, seamlessly with weapons, trains, et cetera.
  420. -- Parts should be ANCHORED before use. It will, however, store relatives values and so when tools are reparented, it'll fix them.
  421.  
  422. --[[ INSTRUCTIONS
  423. - Place in the model
  424. - Make sure model is anchored
  425. - That's it. It will weld the model and all children.
  426.  
  427. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  428. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  429. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  430. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  431. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  432. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  433. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  434. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  435.  
  436. This script is designed to be used is a regular script. In a local script it will weld, but it will not attempt to handle ancestory changes.
  437. ]]
  438.  
  439. --[[ DOCUMENTATION
  440. - Will work in tools. If ran more than once it will not create more than one weld. This is especially useful for tools that are dropped and then picked up again.
  441. - Will work in PBS servers
  442. - Will work as long as it starts out with the part anchored
  443. - Stores the relative CFrame as a CFrame value
  444. - Takes careful measure to reduce lag by not having a joint set off or affected by the parts offset from origin
  445. - Utilizes a recursive algorith to find all parts in the model
  446. - Will reweld on script reparent if the script is initially parented to a tool.
  447. - Welds as fast as possible
  448. ]]
  449.  
  450. -- qPerfectionWeld.lua
  451. -- Created 10/6/2014
  452. -- Author: Quenty
  453. -- Version 1.0.3
  454.  
  455. -- Updated 10/14/2014 - Updated to 1.0.1
  456. --- Bug fix with existing ROBLOX welds ? Repro by asimo3089
  457.  
  458. -- Updated 10/14/2014 - Updated to 1.0.2
  459. --- Fixed bug fix.
  460.  
  461. -- Updated 10/14/2014 - Updated to 1.0.3
  462. --- Now handles joints semi-acceptably. May be rather hacky with some joints. :/
  463.  
  464. local NEVER_BREAK_JOINTS = false -- If you set this to true it will never break joints (this can create some welding issues, but can save stuff like hinges).
  465.  
  466.  
  467. local function CallOnChildren(Instance, FunctionToCall)
  468. -- Calls a function on each of the children of a certain object, using recursion.
  469.  
  470. FunctionToCall(Instance)
  471.  
  472. for _, Child in next, Instance:GetChildren() do
  473. CallOnChildren(Child, FunctionToCall)
  474. end
  475. end
  476.  
  477. local function GetNearestParent(Instance, ClassName)
  478. -- Returns the nearest parent of a certain class, or returns nil
  479.  
  480. local Ancestor = Instance
  481. repeat
  482. Ancestor = Ancestor.Parent
  483. if Ancestor == nil then
  484. return nil
  485. end
  486. until Ancestor:IsA(ClassName)
  487.  
  488. return Ancestor
  489. end
  490.  
  491. local function GetBricks(StartInstance)
  492. local List = {}
  493.  
  494. -- if StartInstance:IsA("BasePart") then
  495. -- List[#List+1] = StartInstance
  496. -- end
  497.  
  498. CallOnChildren(StartInstance, function(Item)
  499. if Item:IsA("BasePart") then
  500. List[#List+1] = Item;
  501. end
  502. end)
  503.  
  504. return List
  505. end
  506.  
  507. local function Modify(Instance, Values)
  508. -- Modifies an Instance by using a table.
  509.  
  510. assert(type(Values) == "table", "Values is not a table");
  511.  
  512. for Index, Value in next, Values do
  513. if type(Index) == "number" then
  514. Value.Parent = Instance
  515. else
  516. Instance[Index] = Value
  517. end
  518. end
  519. return Instance
  520. end
  521.  
  522. local function Make(ClassType, Properties)
  523. -- Using a syntax hack to create a nice way to Make new items.
  524.  
  525. return Modify(Instance.new(ClassType), Properties)
  526. end
  527.  
  528. local Surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
  529. local HingSurfaces = {"Hinge", "Motor", "SteppingMotor"}
  530.  
  531. local function HasWheelJoint(Part)
  532. for _, SurfaceName in pairs(Surfaces) do
  533. for _, HingSurfaceName in pairs(HingSurfaces) do
  534. if Part[SurfaceName].Name == HingSurfaceName then
  535. return true
  536. end
  537. end
  538. end
  539.  
  540. return false
  541. end
  542.  
  543. local function ShouldBreakJoints(Part)
  544. --- We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are
  545. -- definitely some edge cases.
  546.  
  547. if NEVER_BREAK_JOINTS then
  548. return false
  549. end
  550.  
  551. if HasWheelJoint(Part) then
  552. return false
  553. end
  554.  
  555. local Connected = Part:GetConnectedParts()
  556.  
  557. if #Connected == 1 then
  558. return false
  559. end
  560.  
  561. for _, Item in pairs(Connected) do
  562. if HasWheelJoint(Item) then
  563. return false
  564. elseif not Item:IsDescendantOf(script.Parent) then
  565. return false
  566. end
  567. end
  568.  
  569. return true
  570. end
  571.  
  572. local function WeldTogether(Part0, Part1, JointType, WeldParent)
  573. --- Weld's 2 parts together
  574. -- @param Part0 The first part
  575. -- @param Part1 The second part (Dependent part most of the time).
  576. -- @param [JointType] The type of joint. Defaults to weld.
  577. -- @param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
  578. -- @return The weld created.
  579.  
  580. JointType = JointType or "Weld"
  581. local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue")
  582.  
  583. local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)
  584. Modify(NewWeld, {
  585. Name = "qCFrameWeldThingy";
  586. Part0 = Part0;
  587. Part1 = Part1;
  588. C0 = CFrame.new();--Part0.CFrame:inverse();
  589. C1 = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
  590. Parent = Part1;
  591. })
  592.  
  593. if not RelativeValue then
  594. RelativeValue = Make("CFrameValue", {
  595. Parent = Part1;
  596. Name = "qRelativeCFrameWeldValue";
  597. Archivable = true;
  598. Value = NewWeld.C1;
  599. })
  600. end
  601.  
  602. return NewWeld
  603. end
  604.  
  605. local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
  606. -- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
  607. -- @param MainPart The part to weld the model to (can be in the model).
  608. -- @param [JointType] The type of joint. Defaults to weld.
  609. -- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.
  610.  
  611. for _, Part in pairs(Parts) do
  612. if ShouldBreakJoints(Part) then
  613. Part:BreakJoints()
  614. end
  615. end
  616.  
  617. for _, Part in pairs(Parts) do
  618. if Part ~= MainPart then
  619. WeldTogether(MainPart, Part, JointType, MainPart)
  620. end
  621. end
  622.  
  623. if not DoNotUnanchor then
  624. for _, Part in pairs(Parts) do
  625. Part.Anchored = false
  626. end
  627. MainPart.Anchored = false
  628. end
  629. end
  630.  
  631. local function PerfectionWeld()
  632. local Tool = GetNearestParent(script, "Tool")
  633.  
  634. local Parts = GetBricks(script.Parent)
  635. local PrimaryPart = Tool and Tool:FindFirstChild("Handle") and Tool.Handle:IsA("BasePart") and Tool.Handle or script.Parent:IsA("Model") and script.Parent.PrimaryPart or Parts[1]
  636.  
  637. if PrimaryPart then
  638. WeldParts(Parts, PrimaryPart, "Weld", false)
  639. else
  640. warn("qWeld - Unable to weld part")
  641. end
  642.  
  643. return Tool
  644. end
  645.  
  646. local Tool = PerfectionWeld()
  647.  
  648.  
  649. if Tool and script.ClassName == "Script" then
  650. --- Don't bother with local scripts
  651.  
  652. script.Parent.AncestryChanged:connect(function()
  653. PerfectionWeld()
  654. end)
  655. end
  656.  
  657. -- Created by Quenty (@Quenty, follow me on twitter).
  658.  
  659. end))
  660. LocalScript6.Name = "Animate"
  661. LocalScript6.Parent = Tool0
  662. table.insert(cors,sandbox(LocalScript6,function()
  663. local arms = nil
  664. local torso = nil
  665. local welds = {}
  666. local Tool = script.Parent
  667. local neck = nil
  668. local orginalC0 = CFrame.new(0, 1, 0, -1, -0, -0, 0, 0, 1, 0, 1, 0)
  669.  
  670. function Equip(mouse)
  671. wait(0.01)
  672. arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")}
  673. head = Tool.Parent:FindFirstChild("Head")
  674. torso = Tool.Parent:FindFirstChild("Torso")
  675. if neck == nil then
  676. neck = Tool.Parent:FindFirstChild("Torso").Neck
  677. end
  678. if arms ~= nil and torso ~= nil then
  679. local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
  680. if sh ~= nil then
  681. local yes = true
  682. if yes then
  683. yes = false
  684. sh[1].Part1 = nil
  685. sh[2].Part1 = nil
  686. local weld1 = Instance.new("Weld")
  687. weld1.Part0 = head
  688. weld1.Parent = head
  689. weld1.Part1 = arms[1]
  690. welds[1] = weld1
  691. local weld2 = Instance.new("Weld")
  692. weld2.Part0 = head
  693. weld2.Parent = head
  694. weld2.Part1 = arms[2]
  695. welds[2] = weld2
  696. -------------------------here
  697. weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
  698. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
  699. mouse.Move:connect(function ()
  700. --local Direction = Tool.Direction.Value
  701. local Direction = mouse.Hit.p
  702. local b = head.Position.Y-Direction.Y
  703. local dist = (head.Position-Direction).magnitude
  704. local answer = math.asin(b/dist)
  705. neck.C0=orginalC0*CFrame.fromEulerAnglesXYZ(answer,0,0)
  706. wait(0.1)
  707. end)end
  708. else
  709. print("sh")
  710. end
  711. else
  712. print("arms")
  713. end
  714. end
  715.  
  716. function Unequip(mouse)
  717. if arms ~= nil and torso ~= nil then
  718. local sh = {torso:FindFirstChild("Left Shoulder"), torso:FindFirstChild("Right Shoulder")}
  719. if sh ~= nil then
  720. local yes = true
  721. if yes then
  722. yes = false
  723. neck.C0 = orginalC0
  724.  
  725. sh[1].Part1 = arms[1]
  726. sh[2].Part1 = arms[2]
  727. welds[1].Parent = nil
  728. welds[2].Parent = nil
  729. end
  730. else
  731. print("sh")
  732. end
  733. else
  734. print("arms")
  735. end
  736. end
  737. Tool.Equipped:connect(Equip)
  738. Tool.Unequipped:connect(Unequip)
  739.  
  740. function Animate()
  741. arms = {Tool.Parent:FindFirstChild("Left Arm"), Tool.Parent:FindFirstChild("Right Arm")}
  742. if Tool.AnimateValue.Value == "Shoot" then
  743. local weld1 = welds[1]
  744. local weld2 = welds[2]
  745. weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
  746. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
  747. wait(0.00001)
  748. weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.05, math.rad(-90))
  749. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
  750. wait(0.00001)
  751. weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.1, math.rad(-90))
  752. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-95), math.rad(-15), 0)
  753. wait(0.00001)
  754. weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.3, math.rad(-90))
  755. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-110), math.rad(-15), 0)
  756. wait(0.00001)
  757. weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.35, math.rad(-90))
  758. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-115), math.rad(-15), 0)
  759. wait(0.00001)
  760. weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
  761. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
  762. wait(0.00001)
  763. weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
  764. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
  765. Tool.AnimateValue.Value = "None"
  766. end
  767. if Tool.AnimateValue.Value == "Reload" then
  768. local weld1 = welds[1]
  769. local weld2 = welds[2]
  770. weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
  771. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
  772. wait(0.0001)
  773. weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
  774. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
  775. wait(0.0001)
  776. weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
  777. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-95), math.rad(-15), 0)
  778. wait(0.0001)
  779. weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
  780. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-100), math.rad(-15), 0)
  781. wait(0.0001)
  782. weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
  783. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-105), math.rad(-15), 0)
  784. wait(0.0001)
  785. weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
  786. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-110), math.rad(-15), 0)
  787. wait(0.0001)
  788. weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.4, math.rad(-90))
  789. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-115), math.rad(-15), 0)
  790. wait(0.0001)
  791. weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.45, math.rad(-90))
  792. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
  793. wait(0.0001)
  794. weld1.C1 = CFrame.new(-0.5+1.5, 0.9, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.5, math.rad(-90))
  795. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
  796. wait(0.0001)
  797. weld1.C1 = CFrame.new(-0.5+1.5, 1, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.55, math.rad(-90))
  798. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
  799. wait(0.0001)
  800. weld1.C1 = CFrame.new(-0.5+1.5, 1.1, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.57, math.rad(-90))
  801. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
  802. wait(0.0001)
  803. weld1.C1 = CFrame.new(-0.5+1.5, 1.2, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.6, math.rad(-90))
  804. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
  805. wait(0.0001)
  806. weld1.C1 = CFrame.new(-0.5+1.5, 1.3, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0.6, math.rad(-90))
  807. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-120), math.rad(-15), 0)
  808. wait(0.0001)
  809. weld1.C1 = CFrame.new(-0.5+1.5, 0.8, .9)* CFrame.fromEulerAnglesXYZ(math.rad(290), 0, math.rad(-90))
  810. weld2.C1 = CFrame.new(-1, 0.8, 0.5-1.5) * CFrame.fromEulerAnglesXYZ(math.rad(-90), math.rad(-15), 0)
  811. Tool.AnimateValue.Value = "None"
  812. end
  813. end
  814.  
  815. Tool.AnimateValue.Changed:connect(Animate)
  816.  
  817. end))
  818. Script7.Name = "LineConnect"
  819. Script7.Parent = Tool0
  820. Script7.Disabled = true
  821. table.insert(cors,sandbox(Script7,function()
  822. wait()
  823. local check = script.Part2
  824. local part1 = script.Part1.Value
  825. local part2 = script.Part2.Value
  826. local parent = script.Par.Value
  827. local color = script.Color
  828. local line = Instance.new("Part")
  829. line.TopSurface = 0
  830. line.BottomSurface = 0
  831. line.Reflectance = .5
  832. line.Name = "Laser"
  833. line.Transparency = 0.6
  834. line.Locked = true
  835. line.CanCollide = false
  836. line.Anchored = true
  837. line.formFactor = 0
  838. line.Size = Vector3.new(0.4,0.4,1)
  839. local mesh = Instance.new("BlockMesh")
  840. mesh.Parent = line
  841. while true do
  842. if (check.Value==nil) then break end
  843. if (part1==nil or part2==nil or parent==nil) then break end
  844. if (part1.Parent==nil or part2.Parent==nil) then break end
  845. if (parent.Parent==nil) then break end
  846. local lv = CFrame.new(part1.Position,part2.Position)
  847. local dist = (part1.Position-part2.Position).magnitude
  848. line.Parent = parent
  849. line.Material = "Neon"
  850. line.BrickColor = color.Value.BrickColor
  851. line.Reflectance = color.Value.Reflectance
  852. line.Transparency = "0.2"
  853. line.CFrame = CFrame.new(part1.Position+lv.lookVector*dist/2)
  854. line.CFrame = CFrame.new(line.Position,part2.Position)
  855. mesh.Scale = Vector3.new(.25,.25,dist)
  856. wait()
  857. end
  858. line:remove()
  859. script:remove()
  860. end))
  861. LocalScript8.Name = "MainScript"
  862. LocalScript8.Parent = Tool0
  863. table.insert(cors,sandbox(LocalScript8,function()
  864. --Physics gun created by Killersoldier45
  865. wait()
  866. tool = script.Parent
  867. lineconnect = tool.LineConnect
  868. object = nil
  869. mousedown = false
  870. found = false
  871. BP = Instance.new("BodyPosition")
  872. BP.maxForce = Vector3.new(math.huge*math.huge,math.huge*math.huge,math.huge*math.huge) --pwns everyone elses bodyposition
  873. BP.P = BP.P*10 --faster movement. less bounceback.
  874. dist = nil
  875. point = Instance.new("Part")
  876. point.Locked = true
  877. point.Anchored = true
  878. point.formFactor = 0
  879. point.Shape = 0
  880. point.Material = 'Neon'
  881. point.BrickColor = BrickColor.new("Toothpaste")
  882. point.Size = Vector3.new(1,1,1)
  883. point.CanCollide = false
  884. local mesh = Instance.new("SpecialMesh")
  885. mesh.MeshType = "Sphere"
  886. mesh.Scale = Vector3.new(.2,.2,.2)
  887. mesh.Parent = point
  888. handle = tool.Shoot
  889. front = tool.Shoot
  890. color = tool.Shoot
  891. objval = nil
  892. local hooked = false
  893. local hookBP = BP:clone()
  894. hookBP.maxForce = Vector3.new(30000,30000,30000)
  895.  
  896. function LineConnect(part1,part2,parent)
  897. local p1 = Instance.new("ObjectValue")
  898. p1.Value = part1
  899. p1.Name = "Part1"
  900. local p2 = Instance.new("ObjectValue")
  901. p2.Value = part2
  902. p2.Name = "Part2"
  903. local par = Instance.new("ObjectValue")
  904. par.Value = parent
  905. par.Name = "Par"
  906. local col = Instance.new("ObjectValue")
  907. col.Value = color
  908. col.Name = "Color"
  909. local s = lineconnect:clone()
  910. s.Disabled = false
  911. p1.Parent = s
  912. p2.Parent = s
  913. par.Parent = s
  914. col.Parent = s
  915. s.Parent = workspace
  916. if (part2==object) then
  917. objval = p2
  918. end
  919. end
  920.  
  921. function onButton1Down(mouse)
  922. if (mousedown==true) then return end
  923. mousedown = true
  924. coroutine.resume(coroutine.create(function()
  925. local p = point:clone()
  926. p.Parent = tool
  927. LineConnect(front,p,workspace)
  928. while (mousedown==true) do
  929. p.Parent = tool
  930. if (object==nil) then
  931. if (mouse.Target==nil) then
  932. local lv = CFrame.new(front.Position,mouse.Hit.p)
  933. p.CFrame = CFrame.new(front.Position+(lv.lookVector*1000))
  934. else
  935. p.CFrame = CFrame.new(mouse.Hit.p)
  936. end
  937. else
  938. LineConnect(front,object,workspace)
  939. break
  940. end
  941. wait()
  942. end
  943. p:remove()
  944. end))
  945. while (mousedown==true) do
  946. if (mouse.Target~=nil) then
  947. local t = mouse.Target
  948. if (t.Anchored==false) then
  949. object = t
  950. dist = (object.Position-front.Position).magnitude
  951. break
  952. end
  953. end
  954. wait()
  955. end
  956. while (mousedown==true) do
  957. if (object.Parent==nil) then break end
  958. local lv = CFrame.new(front.Position,mouse.Hit.p)
  959. BP.Parent = object
  960. BP.position = front.Position+lv.lookVector*dist
  961. wait()
  962. end
  963. BP:remove()
  964. object = nil
  965. objval.Value = nil
  966. end
  967.  
  968. function onKeyDown(key,mouse)
  969. local key = key:lower()
  970. local yesh = false
  971. if (key=="q") then
  972. if (dist>=5) then
  973. dist = dist-5
  974. end
  975. end
  976. if key == "" then
  977. if (object==nil) then return end
  978. for _,v in pairs(object:children()) do
  979. if v.className == "BodyGyro" then
  980. return nil
  981. end
  982. end
  983. BG = Instance.new("BodyGyro")
  984. BG.maxTorque = Vector3.new(math.huge,math.huge,math.huge)
  985. BG.cframe = CFrame.new(object.CFrame.p)
  986. BG.Parent = object
  987. repeat wait() until(object.CFrame == CFrame.new(object.CFrame.p))
  988. BG.Parent = nil
  989. if (object==nil) then return end
  990. for _,v in pairs(object:children()) do
  991. if v.className == "BodyGyro" then
  992. v.Parent = nil
  993. end
  994. end
  995. object.Velocity = Vector3.new(0,0,0)
  996. object.RotVelocity = Vector3.new(0,0,0)
  997. end
  998. if (key=="e") then
  999. dist = dist+5
  1000. end
  1001. if (string.byte(key)==27) then
  1002. if (object==nil) then return end
  1003. local e = Instance.new("Explosion")
  1004. e.Parent = workspace
  1005. e.Position = object.Position
  1006. color.BrickColor = BrickColor.Black()
  1007. point.BrickColor = BrickColor.White()
  1008. wait(.48)
  1009. color.BrickColor = BrickColor.White()
  1010. point.BrickColor = BrickColor.Black()
  1011. end
  1012. if (key=="") then
  1013. if not hooked then
  1014. if (object==nil) then return end
  1015. hooked = true
  1016. hookBP.position = object.Position
  1017. if tool.Parent:findFirstChild("Torso") then
  1018. hookBP.Parent = tool.Parent.Torso
  1019. if dist ~= (object.Size.x+object.Size.y+object.Size.z)+5 then
  1020. dist = (object.Size.x+object.Size.y+object.Size.z)+5
  1021. end
  1022. end
  1023. else
  1024. hooked = false
  1025. hookBP.Parent = nil
  1026. end
  1027. end
  1028. if (key=="r") then
  1029. if (object==nil) then return end
  1030. color.BrickColor = BrickColor.new("Toothpaste")
  1031. point.BrickColor = BrickColor.new("Toothpaste")
  1032. object.Parent = nil
  1033. wait(.48)
  1034. color.BrickColor = BrickColor.new("Toothpaste")
  1035. point.BrickColor = BrickColor.new("Toothpaste")
  1036. end
  1037. if (key=="") then
  1038. if (object==nil) then return end
  1039. local New = object:clone()
  1040. New.Parent = object.Parent
  1041. for _,v in pairs(New:children()) do
  1042. if v.className == "BodyPosition" or v.className == "BodyGyro" then
  1043. v.Parent = nil
  1044. end
  1045. end
  1046. object = New
  1047. mousedown = false
  1048. mousedown = true
  1049. LineConnect(front,object,workspace)
  1050. while (mousedown==true) do
  1051. if (object.Parent==nil) then break end
  1052. local lv = CFrame.new(front.Position,mouse.Hit.p)
  1053. BP.Parent = object
  1054. BP.position = front.Position+lv.lookVector*dist
  1055. wait()
  1056. end
  1057. BP:remove()
  1058. object = nil
  1059. objval.Value = nil
  1060. end
  1061. if (key=="") then
  1062. local Cube = Instance.new("Part")
  1063. Cube.Locked = true
  1064. Cube.Size = Vector3.new(4,4,4)
  1065. Cube.formFactor = 0
  1066. Cube.TopSurface = 0
  1067. Cube.BottomSurface = 0
  1068. Cube.Name = "WeightedStorageCube"
  1069. Cube.Parent = workspace
  1070. Cube.CFrame = CFrame.new(mouse.Hit.p) + Vector3.new(0,2,0)
  1071. for i = 0,5 do
  1072. local Decal = Instance.new("Decal")
  1073. Decal.Texture = "http://www.roblox.com/asset/?id=2662260"
  1074. Decal.Face = i
  1075. Decal.Name = "WeightedStorageCubeDecal"
  1076. Decal.Parent = Cube
  1077. end
  1078. end
  1079. if (key=="") then
  1080. if dist ~= 15 then
  1081. dist = 15
  1082. end
  1083. end
  1084. end
  1085.  
  1086. function onEquipped(mouse)
  1087. keymouse = mouse
  1088. local char = tool.Parent
  1089. human = char.Humanoid
  1090. human.Changed:connect(function() if (human.Health==0) then mousedown = false BP:remove() point:remove() tool:remove() end end)
  1091. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  1092. mouse.Button1Up:connect(function() mousedown = false end)
  1093. mouse.KeyDown:connect(function(key) onKeyDown(key,mouse) end)
  1094. mouse.Icon = "rbxassetid:// 509381906"
  1095. end
  1096.  
  1097. tool.Equipped:connect(onEquipped)
  1098. end))
  1099. Part9.Name = "GlowPart"
  1100. Part9.Parent = Tool0
  1101. Part9.Material = Enum.Material.Neon
  1102. Part9.BrickColor = BrickColor.new("Cyan")
  1103. Part9.Transparency = 0.5
  1104. Part9.Rotation = Vector3.new(0, -89.5899963, 0)
  1105. Part9.Shape = Enum.PartType.Cylinder
  1106. Part9.Size = Vector3.new(1.20000005, 0.649999976, 2)
  1107. Part9.CFrame = CFrame.new(-54.8191681, 0.773548007, -0.0522949994, 0.00736002205, 4.68389771e-11, -0.999974668, 4.72937245e-11, 1, 1.41590961e-10, 0.999974668, 5.09317033e-11, 0.00736002252)
  1108. Part9.Color = Color3.new(0.0156863, 0.686275, 0.92549)
  1109. Part9.Position = Vector3.new(-54.8191681, 0.773548007, -0.0522949994)
  1110. Part9.Orientation = Vector3.new(0, -89.5799942, 0)
  1111. Part9.Color = Color3.new(0.0156863, 0.686275, 0.92549)
  1112. Script10.Name = "Glow Script"
  1113. Script10.Parent = Part9
  1114. table.insert(cors,sandbox(Script10,function()
  1115. while true do
  1116. wait(0.05)
  1117. script.Parent.Transparency = .5
  1118. wait(0.05)
  1119. script.Parent.Transparency = .6
  1120. wait(0.05)
  1121. script.Parent.Transparency = .7
  1122. wait(0.05)
  1123. script.Parent.Transparency = .8
  1124. wait(0.05)
  1125. script.Parent.Transparency = .9
  1126. wait(0.05)
  1127. script.Parent.Transparency = .8
  1128. wait(0.05)
  1129. script.Parent.Transparency = .7
  1130. wait(0.05)
  1131. script.Parent.Transparency = .6
  1132. wait(0.05)
  1133. script.Parent.Transparency = .5
  1134. end
  1135.  
  1136. end))
  1137. Part11.Name = "GlowPart"
  1138. Part11.Parent = Tool0
  1139. Part11.Material = Enum.Material.Neon
  1140. Part11.BrickColor = BrickColor.new("Cyan")
  1141. Part11.Transparency = 0.5
  1142. Part11.Rotation = Vector3.new(-89.3799973, -55.7399979, -89.25)
  1143. Part11.Size = Vector3.new(0.280000001, 0.25999999, 0.200000003)
  1144. Part11.CFrame = CFrame.new(-54.9808807, 0.99843204, 0.799362957, 0.00736002205, 0.562958956, -0.826454222, 4.72937245e-11, 0.826475084, 0.56297338, 0.999974668, -0.00414349511, 0.00608287565)
  1145. Part11.Color = Color3.new(0.0156863, 0.686275, 0.92549)
  1146. Part11.Position = Vector3.new(-54.9808807, 0.99843204, 0.799362957)
  1147. Part11.Orientation = Vector3.new(-34.2599983, -89.5799942, 0)
  1148. Part11.Color = Color3.new(0.0156863, 0.686275, 0.92549)
  1149. Script12.Name = "Glow Script"
  1150. Script12.Parent = Part11
  1151. table.insert(cors,sandbox(Script12,function()
  1152. while true do
  1153. wait(0.05)
  1154. script.Parent.Transparency = .5
  1155. wait(0.05)
  1156. script.Parent.Transparency = .6
  1157. wait(0.05)
  1158. script.Parent.Transparency = .7
  1159. wait(0.05)
  1160. script.Parent.Transparency = .8
  1161. wait(0.05)
  1162. script.Parent.Transparency = .9
  1163. wait(0.05)
  1164. script.Parent.Transparency = .8
  1165. wait(0.05)
  1166. script.Parent.Transparency = .7
  1167. wait(0.05)
  1168. script.Parent.Transparency = .6
  1169. wait(0.05)
  1170. script.Parent.Transparency = .5
  1171. end
  1172.  
  1173. end))
  1174. Part13.Name = "GlowPart"
  1175. Part13.Parent = Tool0
  1176. Part13.Material = Enum.Material.Neon
  1177. Part13.BrickColor = BrickColor.new("Cyan")
  1178. Part13.Transparency = 0.5
  1179. Part13.Rotation = Vector3.new(95.1500015, -53.8199997, 98.0799942)
  1180. Part13.Size = Vector3.new(0.280000001, 0.25999999, 0.200000003)
  1181. Part13.CFrame = CFrame.new(-54.5909271, 0.978429973, 0.799362957, -0.0830051303, -0.584483683, -0.807150841, 0.0241250042, 0.808528602, -0.58796227, 0.996258855, -0.0682764053, -0.0530113392)
  1182. Part13.Color = Color3.new(0.0156863, 0.686275, 0.92549)
  1183. Part13.Position = Vector3.new(-54.5909271, 0.978429973, 0.799362957)
  1184. Part13.Orientation = Vector3.new(36.0099983, -93.7599945, 1.70999992)
  1185. Part13.Color = Color3.new(0.0156863, 0.686275, 0.92549)
  1186. Script14.Name = "Glow Script"
  1187. Script14.Parent = Part13
  1188. table.insert(cors,sandbox(Script14,function()
  1189. while true do
  1190. wait(0.05)
  1191. script.Parent.Transparency = .5
  1192. wait(0.05)
  1193. script.Parent.Transparency = .6
  1194. wait(0.05)
  1195. script.Parent.Transparency = .7
  1196. wait(0.05)
  1197. script.Parent.Transparency = .8
  1198. wait(0.05)
  1199. script.Parent.Transparency = .9
  1200. wait(0.05)
  1201. script.Parent.Transparency = .8
  1202. wait(0.05)
  1203. script.Parent.Transparency = .7
  1204. wait(0.05)
  1205. script.Parent.Transparency = .6
  1206. wait(0.05)
  1207. script.Parent.Transparency = .5
  1208. end
  1209.  
  1210. end))
  1211. for i,v in pairs(mas:GetChildren()) do
  1212. v.Parent = game:GetService("Players").LocalPlayer.Backpack
  1213. pcall(function() v:MakeJoints() end)
  1214. end
  1215. mas:Destroy()
  1216. for i,v in pairs(cors) do
  1217. spawn(function()
  1218. pcall(v)
  1219. end)
  1220. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement