Advertisement
-----------------

Physics gun (from gmod) (fe?)

Mar 27th, 2020
2,308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 40.73 KB | None | 0 0
  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 parent = script.Par.Value
  824. local color = script.Color
  825. local line = Instance.new("Part")
  826. line.TopSurface = 0
  827. line.BottomSurface = 0
  828. line.Reflectance = .5
  829. line.Name = "Laser"
  830. line.Transparency = 0.6
  831. line.Locked = true
  832. line.CanCollide = false
  833. line.Anchored = true
  834. line.formFactor = 0
  835. line.Size = Vector3.new(0.4,0.4,1)
  836. local mesh = Instance.new("BlockMesh")
  837. mesh.Parent = line
  838. while true do
  839. if (check.Value==nil) then break end
  840. if (part1==nil or part2==nil or parent==nil) then break end
  841. if (part1.Parent==nil or part2.Parent==nil) then break end
  842. if (parent.Parent==nil) then break end
  843. local lv = CFrame.new(part1.Position,part2.Position)
  844. local dist = (part1.Position-part2.Position).magnitude
  845. line.Parent = parent
  846. line.Material = "Neon"
  847. line.BrickColor = color.Value.BrickColor
  848. line.Reflectance = color.Value.Reflectance
  849. line.Transparency = "0.2"
  850. line.CFrame = CFrame.new(part1.Position+lv.lookVector*dist/2)
  851. line.CFrame = CFrame.new(line.Position,part2.Position)
  852. mesh.Scale = Vector3.new(.25,.25,dist)
  853. wait()
  854. end
  855. line:remove()
  856. script:remove()
  857. end))
  858. LocalScript8.Name = "MainScript"
  859. LocalScript8.Parent = Tool0
  860. table.insert(cors,sandbox(LocalScript8,function()
  861. --Physics gun created by Killersoldier45
  862. wait()
  863. tool = script.Parent
  864. lineconnect = tool.LineConnect
  865. object = nil
  866. mousedown = false
  867. found = false
  868. BP = Instance.new("BodyPosition")
  869. BP.maxForce = Vector3.new(math.huge*math.huge,math.huge*math.huge,math.huge*math.huge) --pwns everyone elses bodyposition
  870. BP.P = BP.P*10 --faster movement. less bounceback.
  871. dist = nil
  872. point = Instance.new("Part")
  873. point.Locked = true
  874. point.Anchored = true
  875. point.formFactor = 0
  876. point.Shape = 0
  877. point.Material = 'Neon'
  878. point.BrickColor = BrickColor.new("Toothpaste")
  879. point.Size = Vector3.new(1,1,1)
  880. point.CanCollide = false
  881. local mesh = Instance.new("SpecialMesh")
  882. mesh.MeshType = "Sphere"
  883. mesh.Scale = Vector3.new(.2,.2,.2)
  884. mesh.Parent = point
  885. handle = tool.Shoot
  886. front = tool.Shoot
  887. color = tool.Shoot
  888. objval = nil
  889. local hooked = false
  890. local hookBP = BP:clone()
  891. hookBP.maxForce = Vector3.new(30000,30000,30000)
  892.  
  893. function LineConnect(part1,part2,parent)
  894. local p1 = Instance.new("ObjectValue")
  895. p1.Value = part1
  896. p1.Name = "Part1"
  897. local p2 = Instance.new("ObjectValue")
  898. p2.Value = part2
  899. p2.Name = "Part2"
  900. local par = Instance.new("ObjectValue")
  901. par.Value = parent
  902. par.Name = "Par"
  903. local col = Instance.new("ObjectValue")
  904. col.Value = color
  905. col.Name = "Color"
  906. local s = lineconnect:clone()
  907. s.Disabled = false
  908. p1.Parent = s
  909. p2.Parent = s
  910. par.Parent = s
  911. col.Parent = s
  912. s.Parent = workspace
  913. if (part2==object) then
  914. objval = p2
  915. end
  916. end
  917.  
  918. function onButton1Down(mouse)
  919. if (mousedown==true) then return end
  920. mousedown = true
  921. coroutine.resume(coroutine.create(function()
  922. local p = point:clone()
  923. p.Parent = tool
  924. LineConnect(front,p,workspace)
  925. while (mousedown==true) do
  926. p.Parent = tool
  927. if (object==nil) then
  928. if (mouse.Target==nil) then
  929. local lv = CFrame.new(front.Position,mouse.Hit.p)
  930. p.CFrame = CFrame.new(front.Position+(lv.lookVector*1000))
  931. else
  932. p.CFrame = CFrame.new(mouse.Hit.p)
  933. end
  934. else
  935. LineConnect(front,object,workspace)
  936. break
  937. end
  938. wait()
  939. end
  940. p:remove()
  941. end))
  942. while (mousedown==true) do
  943. if (mouse.Target~=nil) then
  944. local t = mouse.Target
  945. if (t.Anchored==false) then
  946. object = t
  947. dist = (object.Position-front.Position).magnitude
  948. break
  949. end
  950. end
  951. wait()
  952. end
  953. while (mousedown==true) do
  954. if (object.Parent==nil) then break end
  955. local lv = CFrame.new(front.Position,mouse.Hit.p)
  956. BP.Parent = object
  957. BP.position = front.Position+lv.lookVector*dist
  958. wait()
  959. end
  960. BP:remove()
  961. object = nil
  962. objval.Value = nil
  963. end
  964.  
  965. function onKeyDown(key,mouse)
  966. local key = key:lower()
  967. local yesh = false
  968. if (key=="q") then
  969. if (dist>=5) then
  970. dist = dist-5
  971. end
  972. end
  973. if key == "" then
  974. if (object==nil) then return end
  975. for _,v in pairs(object:children()) do
  976. if v.className == "BodyGyro" then
  977. return nil
  978. end
  979. end
  980. BG = Instance.new("BodyGyro")
  981. BG.maxTorque = Vector3.new(math.huge,math.huge,math.huge)
  982. BG.cframe = CFrame.new(object.CFrame.p)
  983. BG.Parent = object
  984. repeat wait() until(object.CFrame == CFrame.new(object.CFrame.p))
  985. BG.Parent = nil
  986. if (object==nil) then return end
  987. for _,v in pairs(object:children()) do
  988. if v.className == "BodyGyro" then
  989. v.Parent = nil
  990. end
  991. end
  992. object.Velocity = Vector3.new(0,0,0)
  993. object.RotVelocity = Vector3.new(0,0,0)
  994. end
  995. if (key=="e") then
  996. dist = dist+5
  997. end
  998. if (string.byte(key)==27) then
  999. if (object==nil) then return end
  1000. local e = Instance.new("Explosion")
  1001. e.Parent = workspace
  1002. e.Position = object.Position
  1003. color.BrickColor = BrickColor.Black()
  1004. point.BrickColor = BrickColor.White()
  1005. wait(.48)
  1006. color.BrickColor = BrickColor.White()
  1007. point.BrickColor = BrickColor.Black()
  1008. end
  1009. if (key=="") then
  1010. if not hooked then
  1011. if (object==nil) then return end
  1012. hooked = true
  1013. hookBP.position = object.Position
  1014. if tool.Parent:findFirstChild("Torso") then
  1015. hookBP.Parent = tool.Parent.Torso
  1016. if dist ~= (object.Size.x+object.Size.y+object.Size.z)+5 then
  1017. dist = (object.Size.x+object.Size.y+object.Size.z)+5
  1018. end
  1019. end
  1020. else
  1021. hooked = false
  1022. hookBP.Parent = nil
  1023. end
  1024. end
  1025. if (key=="r") then
  1026. if (object==nil) then return end
  1027. color.BrickColor = BrickColor.new("Toothpaste")
  1028. point.BrickColor = BrickColor.new("Toothpaste")
  1029. object.Parent = nil
  1030. wait(.48)
  1031. color.BrickColor = BrickColor.new("Toothpaste")
  1032. point.BrickColor = BrickColor.new("Toothpaste")
  1033. end
  1034. if (key=="") then
  1035. if (object==nil) then return end
  1036. local New = object:clone()
  1037. New.Parent = object.Parent
  1038. for _,v in pairs(New:children()) do
  1039. if v.className == "BodyPosition" or v.className == "BodyGyro" then
  1040. v.Parent = nil
  1041. end
  1042. end
  1043. object = New
  1044. mousedown = false
  1045. mousedown = true
  1046. LineConnect(front,object,workspace)
  1047. while (mousedown==true) do
  1048. if (object.Parent==nil) then break end
  1049. local lv = CFrame.new(front.Position,mouse.Hit.p)
  1050. BP.Parent = object
  1051. BP.position = front.Position+lv.lookVector*dist
  1052. wait()
  1053. end
  1054. BP:remove()
  1055. object = nil
  1056. objval.Value = nil
  1057. end
  1058. if (key=="") then
  1059. local Cube = Instance.new("Part")
  1060. Cube.Locked = true
  1061. Cube.Size = Vector3.new(4,4,4)
  1062. Cube.formFactor = 0
  1063. Cube.TopSurface = 0
  1064. Cube.BottomSurface = 0
  1065. Cube.Name = "WeightedStorageCube"
  1066. Cube.Parent = workspace
  1067. Cube.CFrame = CFrame.new(mouse.Hit.p) + Vector3.new(0,2,0)
  1068. for i = 0,5 do
  1069. local Decal = Instance.new("Decal")
  1070. Decal.Texture = "http://www.roblox.com/asset/?id=2662260"
  1071. Decal.Face = i
  1072. Decal.Name = "WeightedStorageCubeDecal"
  1073. Decal.Parent = Cube
  1074. end
  1075. end
  1076. if (key=="") then
  1077. if dist ~= 15 then
  1078. dist = 15
  1079. end
  1080. end
  1081. end
  1082.  
  1083. function onEquipped(mouse)
  1084. keymouse = mouse
  1085. local char = tool.Parent
  1086. human = char.Humanoid
  1087. human.Changed:connect(function() if (human.Health==0) then mousedown = false BP:remove() point:remove() tool:remove() end end)
  1088. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  1089. mouse.Button1Up:connect(function() mousedown = false end)
  1090. mouse.KeyDown:connect(function(key) onKeyDown(key,mouse) end)
  1091. mouse.Icon = "rbxassetid:// 509381906"
  1092. end
  1093.  
  1094. tool.Equipped:connect(onEquipped)
  1095. end))
  1096. Part9.Name = "GlowPart"
  1097. Part9.Parent = Tool0
  1098. Part9.Material = Enum.Material.Neon
  1099. Part9.BrickColor = BrickColor.new("Cyan")
  1100. Part9.Transparency = 0.5
  1101. Part9.Rotation = Vector3.new(0, -89.5899963, 0)
  1102. Part9.Shape = Enum.PartType.Cylinder
  1103. Part9.Size = Vector3.new(1.20000005, 0.649999976, 2)
  1104. 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)
  1105. Part9.Color = Color3.new(0.0156863, 0.686275, 0.92549)
  1106. Part9.Position = Vector3.new(-54.8191681, 0.773548007, -0.0522949994)
  1107. Part9.Orientation = Vector3.new(0, -89.5799942, 0)
  1108. Part9.Color = Color3.new(0.0156863, 0.686275, 0.92549)
  1109. Script10.Name = "Glow Script"
  1110. Script10.Parent = Part9
  1111. table.insert(cors,sandbox(Script10,function()
  1112. while true do
  1113. wait(0.05)
  1114. script.Parent.Transparency = .5
  1115. wait(0.05)
  1116. script.Parent.Transparency = .6
  1117. wait(0.05)
  1118. script.Parent.Transparency = .7
  1119. wait(0.05)
  1120. script.Parent.Transparency = .8
  1121. wait(0.05)
  1122. script.Parent.Transparency = .9
  1123. wait(0.05)
  1124. script.Parent.Transparency = .8
  1125. wait(0.05)
  1126. script.Parent.Transparency = .7
  1127. wait(0.05)
  1128. script.Parent.Transparency = .6
  1129. wait(0.05)
  1130. script.Parent.Transparency = .5
  1131. end
  1132.  
  1133. end))
  1134. Part11.Name = "GlowPart"
  1135. Part11.Parent = Tool0
  1136. Part11.Material = Enum.Material.Neon
  1137. Part11.BrickColor = BrickColor.new("Cyan")
  1138. Part11.Transparency = 0.5
  1139. Part11.Rotation = Vector3.new(-89.3799973, -55.7399979, -89.25)
  1140. Part11.Size = Vector3.new(0.280000001, 0.25999999, 0.200000003)
  1141. 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)
  1142. Part11.Color = Color3.new(0.0156863, 0.686275, 0.92549)
  1143. Part11.Position = Vector3.new(-54.9808807, 0.99843204, 0.799362957)
  1144. Part11.Orientation = Vector3.new(-34.2599983, -89.5799942, 0)
  1145. Part11.Color = Color3.new(0.0156863, 0.686275, 0.92549)
  1146. Script12.Name = "Glow Script"
  1147. Script12.Parent = Part11
  1148. table.insert(cors,sandbox(Script12,function()
  1149. while true do
  1150. wait(0.05)
  1151. script.Parent.Transparency = .5
  1152. wait(0.05)
  1153. script.Parent.Transparency = .6
  1154. wait(0.05)
  1155. script.Parent.Transparency = .7
  1156. wait(0.05)
  1157. script.Parent.Transparency = .8
  1158. wait(0.05)
  1159. script.Parent.Transparency = .9
  1160. wait(0.05)
  1161. script.Parent.Transparency = .8
  1162. wait(0.05)
  1163. script.Parent.Transparency = .7
  1164. wait(0.05)
  1165. script.Parent.Transparency = .6
  1166. wait(0.05)
  1167. script.Parent.Transparency = .5
  1168. end
  1169.  
  1170. end))
  1171. Part13.Name = "GlowPart"
  1172. Part13.Parent = Tool0
  1173. Part13.Material = Enum.Material.Neon
  1174. Part13.BrickColor = BrickColor.new("Cyan")
  1175. Part13.Transparency = 0.5
  1176. Part13.Rotation = Vector3.new(95.1500015, -53.8199997, 98.0799942)
  1177. Part13.Size = Vector3.new(0.280000001, 0.25999999, 0.200000003)
  1178. 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)
  1179. Part13.Color = Color3.new(0.0156863, 0.686275, 0.92549)
  1180. Part13.Position = Vector3.new(-54.5909271, 0.978429973, 0.799362957)
  1181. Part13.Orientation = Vector3.new(36.0099983, -93.7599945, 1.70999992)
  1182. Part13.Color = Color3.new(0.0156863, 0.686275, 0.92549)
  1183. Script14.Name = "Glow Script"
  1184. Script14.Parent = Part13
  1185. table.insert(cors,sandbox(Script14,function()
  1186. while true do
  1187. wait(0.05)
  1188. script.Parent.Transparency = .5
  1189. wait(0.05)
  1190. script.Parent.Transparency = .6
  1191. wait(0.05)
  1192. script.Parent.Transparency = .7
  1193. wait(0.05)
  1194. script.Parent.Transparency = .8
  1195. wait(0.05)
  1196. script.Parent.Transparency = .9
  1197. wait(0.05)
  1198. script.Parent.Transparency = .8
  1199. wait(0.05)
  1200. script.Parent.Transparency = .7
  1201. wait(0.05)
  1202. script.Parent.Transparency = .6
  1203. wait(0.05)
  1204. script.Parent.Transparency = .5
  1205. end
  1206.  
  1207. end))
  1208. for i,v in pairs(mas:GetChildren()) do
  1209. v.Parent = game:GetService("Players").LocalPlayer.Backpack
  1210. pcall(function() v:MakeJoints() end)
  1211. end
  1212. mas:Destroy()
  1213. for i,v in pairs(cors) do
  1214. spawn(function()
  1215. pcall(v)
  1216. end)
  1217. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement