Advertisement
MyNewName

Untitled

Mar 14th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.96 KB | None | 0 0
  1.  
  2. --Converted with ttyyuu12345's model to script plugin v4
  3. function sandbox(var,func)
  4. local env = getfenv(func)
  5. local newenv = setmetatable({},{
  6. __index = function(self,k)
  7. if k=="script" then
  8. return var
  9. else
  10. return env[k]
  11. end
  12. end,
  13. })
  14. setfenv(func,newenv)
  15. return func
  16. end
  17. cors = {}
  18. mas = Instance.new("Model",game:GetService("Lighting"))
  19. Tool0 = Instance.new("Tool")
  20. Part1 = Instance.new("Part")
  21. LocalScript2 = Instance.new("LocalScript")
  22. Script3 = Instance.new("Script")
  23. LocalScript4 = Instance.new("LocalScript")
  24. LocalScript5 = Instance.new("LocalScript")
  25. Part6 = Instance.new("Part")
  26. Tool0.Name = "Aquamarine Wand"
  27. Tool0.Parent = mas
  28. Tool0.GripForward = Vector3.new(-0.914366484, 0.380257547, -0.139060885)
  29. Tool0.GripPos = Vector3.new(0.600966454, 0.271429777, 0.0519190952)
  30. Tool0.GripRight = Vector3.new(-0.128400177, 0.0533977672, 0.990283847)
  31. Tool0.GripUp = Vector3.new(-0.38398847, -0.923337817, 0)
  32. Tool0.CanBeDropped = false
  33. Part1.Name = "Handle"
  34. Part1.Parent = Tool0
  35. Part1.Material = Enum.Material.SmoothPlastic
  36. Part1.BrickColor = BrickColor.new("Navy blue")
  37. Part1.Rotation = Vector3.new(-90, -0.00999999978, -90)
  38. Part1.CanCollide = false
  39. Part1.FormFactor = Enum.FormFactor.Custom
  40. Part1.Shape = Enum.PartType.Cylinder
  41. Part1.Size = Vector3.new(2.13999963, 0.170000076, 0.199999973)
  42. Part1.CFrame = CFrame.new(118.000183, 39.6357765, -40.8030701, 0, 1, -9.89999971e-05, 6.60000005e-05, 9.89999971e-05, 1, 1, -6.53400001e-09, -6.60000005e-05)
  43. Part1.BottomSurface = Enum.SurfaceType.Smooth
  44. Part1.TopSurface = Enum.SurfaceType.Smooth
  45. Part1.Color = Color3.new(0.0862745, 0.105882, 0.407843)
  46. Part1.Position = Vector3.new(118.000183, 39.6357765, -40.8030701)
  47. Part1.Orientation = Vector3.new(-90, -90, 0)
  48. Part1.Color = Color3.new(0.0862745, 0.105882, 0.407843)
  49. LocalScript2.Parent = Tool0
  50. table.insert(cors,sandbox(LocalScript2,function()
  51. -- Variables for services
  52. local render = game:GetService("RunService").RenderStepped
  53. local contextActionService = game:GetService("ContextActionService")
  54. local userInputService = game:GetService("UserInputService")
  55.  
  56. local player = game.Players.LocalPlayer
  57. local mouse = player:GetMouse()
  58. local Tool = script.Parent
  59.  
  60. -- Variables for Module Scripts
  61. local screenSpace = require(Tool:WaitForChild("ScreenSpace"))
  62.  
  63. local connection
  64. -- Variables for character joints
  65.  
  66. local neck, shoulder, oldNeckC0, oldShoulderC0
  67.  
  68. local mobileShouldTrack = true
  69.  
  70. -- Thourough check to see if a character is sitting
  71. local function amISitting(character)
  72. local t = character.Torso
  73. for _, part in pairs(t:GetConnectedParts(true)) do
  74. if part:IsA("Seat") or part:IsA("VehicleSeat") then
  75. return true
  76. end
  77. end
  78. end
  79.  
  80. -- Function to call on renderstepped. Orients the character so it is facing towards
  81. -- the player mouse's position in world space. If character is sitting then the torso
  82. -- should not track
  83. local function frame(mousePosition)
  84. -- Special mobile consideration. We don't want to track if the user was touching a ui
  85. -- element such as the movement controls. Just return out of function if so to make sure
  86. -- character doesn't track
  87. if not mobileShouldTrack then return end
  88.  
  89. -- Make sure character isn't swiming. If the character is swimming the following code will
  90. -- not work well; the character will not swim correctly. Besides, who shoots underwater?
  91. if player.Character.Humanoid:GetState() ~= Enum.HumanoidStateType.Swimming then
  92. local torso = player.Character.Torso
  93. local head = player.Character.Head
  94.  
  95. local toMouse = (mousePosition - head.Position).unit
  96. local angle = math.acos(toMouse:Dot(Vector3.new(0,1,0)))
  97.  
  98. local neckAngle = angle
  99.  
  100. -- Limit how much the head can tilt down. Too far and the head looks unnatural
  101. if math.deg(neckAngle) > 110 then
  102. neckAngle = math.rad(110)
  103. end
  104. neck.C0 = CFrame.new(0,1,0) * CFrame.Angles(math.pi - neckAngle,math.pi,0)
  105.  
  106. -- Calculate horizontal rotation
  107. local arm = player.Character:FindFirstChild("Right Arm")
  108. local fromArmPos = torso.Position + torso.CFrame:vectorToWorldSpace(Vector3.new(
  109. torso.Size.X/2 + arm.Size.X/2, torso.Size.Y/2 - arm.Size.Z/2, 0))
  110. local toMouseArm = ((mousePosition - fromArmPos) * Vector3.new(1,0,1)).unit
  111. local look = (torso.CFrame.lookVector * Vector3.new(1,0,1)).unit
  112. local lateralAngle = math.acos(toMouseArm:Dot(look))
  113.  
  114. -- Check for rogue math
  115. if tostring(lateralAngle) == "-1.#IND" then
  116. lateralAngle = 0
  117. end
  118.  
  119. -- Handle case where character is sitting down
  120. if player.Character.Humanoid:GetState() == Enum.HumanoidStateType.Seated then
  121.  
  122. local cross = torso.CFrame.lookVector:Cross(toMouseArm)
  123. if lateralAngle > math.pi/2 then
  124. lateralAngle = math.pi/2
  125. end
  126. if cross.Y < 0 then
  127. lateralAngle = -lateralAngle
  128. end
  129. end
  130.  
  131. -- Turn shoulder to point to mouse
  132. shoulder.C0 = CFrame.new(1,0.5,0) * CFrame.Angles(math.pi/2 - angle,math.pi/2 + lateralAngle,0)
  133.  
  134. -- If not sitting then aim torso laterally towards mouse
  135. if not amISitting(player.Character) then
  136. torso.CFrame = CFrame.new(torso.Position, torso.Position + (Vector3.new(
  137. mousePosition.X, torso.Position.Y, mousePosition.Z)-torso.Position).unit)
  138. else
  139. --print("sitting")
  140. end
  141. end
  142. end
  143.  
  144. -- Function to bind to render stepped if player is on PC
  145. local function pcFrame()
  146. frame(mouse.Hit.p)
  147. end
  148.  
  149. -- Function to bind to touch moved if player is on mobile
  150. local function mobileFrame(touch, processed)
  151. -- Check to see if the touch was on a UI element. If so, we don't want to update anything
  152. if not processed then
  153. -- Calculate touch position in world space. Uses Stravant's ScreenSpace Module script
  154. -- to create a ray from the camera.
  155. local test = screenSpace.ScreenToWorld(touch.Position.X, touch.Position.Y, 1)
  156. local nearPos = game.Workspace.CurrentCamera.CoordinateFrame:vectorToWorldSpace(screenSpace.ScreenToWorld(touch.Position.X, touch.Position.Y, 1))
  157. nearPos = game.Workspace.CurrentCamera.CoordinateFrame.p - nearPos
  158. local farPos = screenSpace.ScreenToWorld(touch.Position.X, touch.Position.Y,50)
  159. farPos = game.Workspace.CurrentCamera.CoordinateFrame:vectorToWorldSpace(farPos) * -1
  160. if farPos.magnitude > 900 then
  161. farPos = farPos.unit * 900
  162. end
  163. local ray = Ray.new(nearPos, farPos)
  164. local part, pos = game.Workspace:FindPartOnRay(ray, player.Character)
  165.  
  166. -- if a position was found on the ray then update the character's rotation
  167. if pos then
  168. frame(pos)
  169. end
  170. end
  171. end
  172.  
  173. local oldIcon = nil
  174. -- Function to bind to equip event
  175. local function equip()
  176. local torso = player.Character.Torso
  177.  
  178. -- Setup joint variables
  179. neck = torso.Neck
  180. oldNeckC0 = neck.C0
  181. shoulder = torso:FindFirstChild("Right Shoulder")
  182. oldShoulderC0 = shoulder.C0
  183.  
  184. -- Remember old mouse icon and update current
  185. oldIcon = mouse.Icon
  186. mouse.Icon = "http://www.roblox.com/asset/?id=170477320"
  187.  
  188. -- Bind TouchMoved event if on mobile. Otherwise connect to renderstepped
  189. if userInputService.TouchEnabled then
  190. connection = userInputService.TouchMoved:connect(mobileFrame)
  191. else
  192. connection = render:connect(pcFrame)
  193. end
  194.  
  195. -- Bind TouchStarted and TouchEnded. Used to determine if character should rotate
  196. -- during touch input
  197. userInputService.TouchStarted:connect(function(touch, processed)
  198. mobileShouldTrack = not processed
  199. end)
  200. userInputService.TouchEnded:connect(function(touch, processed)
  201. mobileShouldTrack = false
  202. end)
  203.  
  204. -- Fire server's equip event
  205. game.ReplicatedStorage.ROBLOX_PistolEquipEvent:FireServer()
  206.  
  207. -- Bind event for when mouse is clicked to fire server's fire event
  208. mouse.Button1Down:connect(function()
  209. game.ReplicatedStorage.ROBLOX_PistolFireEvent:FireServer(mouse.Hit.p)
  210. end)
  211.  
  212. -- Bind reload event to mobile button and r key
  213. contextActionService:BindActionToInputTypes("Reload", function()
  214. game.ReplicatedStorage.ROBLOX_PistolReloadEvent:FireServer()
  215. end, true, "")
  216.  
  217. -- If game uses filtering enabled then need to update server while tool is
  218. -- held by character.
  219. if workspace.FilteringEnabled then
  220. while connection do
  221. wait()
  222. game.ReplicatedStorage.ROBLOX_PistolUpdateEvent:FireServer(neck.C0, shoulder.C0)
  223. end
  224. end
  225. end
  226.  
  227. -- Function to bind to Unequip event
  228. local function unequip()
  229. if connection then connection:disconnect() end
  230. contextActionService:UnbindAction("Reload")
  231. game.ReplicatedStorage.ROBLOX_PistolUnequipEvent:FireServer()
  232. mouse.Icon = oldIcon
  233. neck.C0 = oldNeckC0
  234. shoulder.C0 = oldShoulderC0
  235. end
  236.  
  237. -- Bind tool events
  238. Tool.Equipped:connect(equip)
  239. Tool.Unequipped:connect(unequip)
  240. end))
  241. Script3.Name = "qPerfectionWeld"
  242. Script3.Parent = Tool0
  243. table.insert(cors,sandbox(Script3,function()
  244. -- Created by Quenty (@Quenty, follow me on twitter).
  245. -- Should work with only ONE copy, seamlessly with weapons, trains, et cetera.
  246. -- Parts should be ANCHORED before use. It will, however, store relatives values and so when tools are reparented, it'll fix them.
  247.  
  248. --[[ INSTRUCTIONS
  249. - Place in the model
  250. - Make sure model is anchored
  251. - That's it. It will weld the model and all children.
  252.  
  253. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  254. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  255. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  256. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  257. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  258. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  259. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  260. THIS SCRIPT SHOULD BE USED ONLY BY ITSELF. THE MODEL SHOULD BE ANCHORED.
  261.  
  262. 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.
  263. ]]
  264.  
  265. --[[ DOCUMENTATION
  266. - 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.
  267. - Will work in PBS servers
  268. - Will work as long as it starts out with the part anchored
  269. - Stores the relative CFrame as a CFrame value
  270. - Takes careful measure to reduce lag by not having a joint set off or affected by the parts offset from origin
  271. - Utilizes a recursive algorith to find all parts in the model
  272. - Will reweld on script reparent if the script is initially parented to a tool.
  273. - Welds as fast as possible
  274. ]]
  275.  
  276. -- qPerfectionWeld.lua
  277. -- Created 10/6/2014
  278. -- Author: Quenty
  279. -- Version 1.0.3
  280.  
  281. -- Updated 10/14/2014 - Updated to 1.0.1
  282. --- Bug fix with existing ROBLOX welds ? Repro by asimo3089
  283.  
  284. -- Updated 10/14/2014 - Updated to 1.0.2
  285. --- Fixed bug fix.
  286.  
  287. -- Updated 10/14/2014 - Updated to 1.0.3
  288. --- Now handles joints semi-acceptably. May be rather hacky with some joints. :/
  289.  
  290. 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).
  291.  
  292.  
  293. local function CallOnChildren(Instance, FunctionToCall)
  294. -- Calls a function on each of the children of a certain object, using recursion.
  295.  
  296. FunctionToCall(Instance)
  297.  
  298. for _, Child in next, Instance:GetChildren() do
  299. CallOnChildren(Child, FunctionToCall)
  300. end
  301. end
  302.  
  303. local function GetNearestParent(Instance, ClassName)
  304. -- Returns the nearest parent of a certain class, or returns nil
  305.  
  306. local Ancestor = Instance
  307. repeat
  308. Ancestor = Ancestor.Parent
  309. if Ancestor == nil then
  310. return nil
  311. end
  312. until Ancestor:IsA(ClassName)
  313.  
  314. return Ancestor
  315. end
  316.  
  317. local function GetBricks(StartInstance)
  318. local List = {}
  319.  
  320. -- if StartInstance:IsA("BasePart") then
  321. -- List[#List+1] = StartInstance
  322. -- end
  323.  
  324. CallOnChildren(StartInstance, function(Item)
  325. if Item:IsA("BasePart") then
  326. List[#List+1] = Item;
  327. end
  328. end)
  329.  
  330. return List
  331. end
  332.  
  333. local function Modify(Instance, Values)
  334. -- Modifies an Instance by using a table.
  335.  
  336. assert(type(Values) == "table", "Values is not a table");
  337.  
  338. for Index, Value in next, Values do
  339. if type(Index) == "number" then
  340. Value.Parent = Instance
  341. else
  342. Instance[Index] = Value
  343. end
  344. end
  345. return Instance
  346. end
  347.  
  348. local function Make(ClassType, Properties)
  349. -- Using a syntax hack to create a nice way to Make new items.
  350.  
  351. return Modify(Instance.new(ClassType), Properties)
  352. end
  353.  
  354. local Surfaces = {"TopSurface", "BottomSurface", "LeftSurface", "RightSurface", "FrontSurface", "BackSurface"}
  355. local HingSurfaces = {"Hinge", "Motor", "SteppingMotor"}
  356.  
  357. local function HasWheelJoint(Part)
  358. for _, SurfaceName in pairs(Surfaces) do
  359. for _, HingSurfaceName in pairs(HingSurfaces) do
  360. if Part[SurfaceName].Name == HingSurfaceName then
  361. return true
  362. end
  363. end
  364. end
  365.  
  366. return false
  367. end
  368.  
  369. local function ShouldBreakJoints(Part)
  370. --- We do not want to break joints of wheels/hinges. This takes the utmost care to not do this. There are
  371. -- definitely some edge cases.
  372.  
  373. if NEVER_BREAK_JOINTS then
  374. return false
  375. end
  376.  
  377. if HasWheelJoint(Part) then
  378. return false
  379. end
  380.  
  381. local Connected = Part:GetConnectedParts()
  382.  
  383. if #Connected == 1 then
  384. return false
  385. end
  386.  
  387. for _, Item in pairs(Connected) do
  388. if HasWheelJoint(Item) then
  389. return false
  390. elseif not Item:IsDescendantOf(script.Parent) then
  391. return false
  392. end
  393. end
  394.  
  395. return true
  396. end
  397.  
  398. local function WeldTogether(Part0, Part1, JointType, WeldParent)
  399. --- Weld's 2 parts together
  400. -- @param Part0 The first part
  401. -- @param Part1 The second part (Dependent part most of the time).
  402. -- @param [JointType] The type of joint. Defaults to weld.
  403. -- @param [WeldParent] Parent of the weld, Defaults to Part0 (so GC is better).
  404. -- @return The weld created.
  405.  
  406. JointType = JointType or "Weld"
  407. local RelativeValue = Part1:FindFirstChild("qRelativeCFrameWeldValue")
  408.  
  409. local NewWeld = Part1:FindFirstChild("qCFrameWeldThingy") or Instance.new(JointType)
  410. Modify(NewWeld, {
  411. Name = "qCFrameWeldThingy";
  412. Part0 = Part0;
  413. Part1 = Part1;
  414. C0 = CFrame.new();--Part0.CFrame:inverse();
  415. C1 = RelativeValue and RelativeValue.Value or Part1.CFrame:toObjectSpace(Part0.CFrame); --Part1.CFrame:inverse() * Part0.CFrame;-- Part1.CFrame:inverse();
  416. Parent = Part1;
  417. })
  418.  
  419. if not RelativeValue then
  420. RelativeValue = Make("CFrameValue", {
  421. Parent = Part1;
  422. Name = "qRelativeCFrameWeldValue";
  423. Archivable = true;
  424. Value = NewWeld.C1;
  425. })
  426. end
  427.  
  428. return NewWeld
  429. end
  430.  
  431. local function WeldParts(Parts, MainPart, JointType, DoNotUnanchor)
  432. -- @param Parts The Parts to weld. Should be anchored to prevent really horrible results.
  433. -- @param MainPart The part to weld the model to (can be in the model).
  434. -- @param [JointType] The type of joint. Defaults to weld.
  435. -- @parm DoNotUnanchor Boolean, if true, will not unachor the model after cmopletion.
  436.  
  437. for _, Part in pairs(Parts) do
  438. if ShouldBreakJoints(Part) then
  439. Part:BreakJoints()
  440. end
  441. end
  442.  
  443. for _, Part in pairs(Parts) do
  444. if Part ~= MainPart then
  445. WeldTogether(MainPart, Part, JointType, MainPart)
  446. end
  447. end
  448.  
  449. if not DoNotUnanchor then
  450. for _, Part in pairs(Parts) do
  451. Part.Anchored = false
  452. end
  453. MainPart.Anchored = false
  454. end
  455. end
  456.  
  457. local function PerfectionWeld()
  458. local Tool = GetNearestParent(script, "Tool")
  459.  
  460. local Parts = GetBricks(script.Parent)
  461. 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]
  462.  
  463. if PrimaryPart then
  464. WeldParts(Parts, PrimaryPart, "Weld", false)
  465. else
  466. warn("qWeld - Unable to weld part")
  467. end
  468.  
  469. return Tool
  470. end
  471.  
  472. local Tool = PerfectionWeld()
  473.  
  474.  
  475. if Tool and script.ClassName == "Script" then
  476. --- Don't bother with local scripts
  477.  
  478. script.Parent.AncestryChanged:connect(function()
  479. PerfectionWeld()
  480. end)
  481. end
  482.  
  483. -- Created by Quenty (@Quenty, follow me on twitter).
  484.  
  485. end))
  486. LocalScript4.Name = "MainScript"
  487. LocalScript4.Parent = Tool0
  488. table.insert(cors,sandbox(LocalScript4,function()
  489. wait()
  490. tool = script.Parent
  491. lineconnect = tool.LineConnect
  492. object = nil
  493. mousedown = false
  494. found = false
  495. BP = Instance.new("BodyPosition")
  496. BP.maxForce = Vector3.new(math.huge*math.huge,math.huge*math.huge,math.huge*math.huge) --pwns everyone elses bodyposition
  497. BP.P = BP.P*10 --faster movement. less bounceback.
  498. dist = nil
  499. point = Instance.new("Part")
  500. point.Locked = true
  501. point.Anchored = true
  502. point.formFactor = 0
  503. point.Shape = 0
  504. point.BrickColor = BrickColor.new("Toothpaste")
  505. point.Size = Vector3.new(1,1,1)
  506. point.CanCollide = false
  507. local mesh = Instance.new("SpecialMesh")
  508. mesh.MeshType = "Sphere"
  509. mesh.Scale = Vector3.new(.35,.35,.35)
  510. mesh.Parent = point
  511. handle = tool.Shoot
  512. front = tool.Shoot
  513. color = tool.Shoot
  514. objval = nil
  515. local hooked = false
  516. local hookBP = BP:clone()
  517. hookBP.maxForce = Vector3.new(30000,30000,30000)
  518.  
  519. function LineConnect(part1,part2,parent)
  520. local p1 = Instance.new("ObjectValue")
  521. p1.Value = part1
  522. p1.Name = "Part1"
  523. local par = Instance.new("ObjectValue")
  524. par.Value = parent
  525. par.Name = "Par"
  526. local col = Instance.new("ObjectValue")
  527. col.Value = color
  528. col.Name = "Color"
  529. local s = lineconnect:Clone()
  530. s.Name = "LineConnectClone"
  531. s.Disabled = false
  532. p1.Parent = s
  533. par.Parent = s
  534. col.Parent = s
  535. s.Parent = tool
  536. if (part2==object) then
  537. objval = p1
  538. end
  539. end
  540.  
  541. function onButton1Down(mouse)
  542. if (mousedown==true) then return end
  543. mousedown = true
  544. coroutine.resume(coroutine.create(function()
  545. local p = point:clone()
  546. p.Parent = tool
  547. LineConnect(front,object,workspace)
  548. while (mousedown==true) do
  549. p.Parent = tool
  550. if (object==nil) then
  551. if (mouse.Target==nil) then
  552. local lv = CFrame.new(front.Position,mouse.Hit.p)
  553. p.CFrame = CFrame.new(front.Position+(lv.lookVector*1000))
  554. else
  555. p.CFrame = CFrame.new(mouse.Hit.p)
  556. end
  557. else
  558. LineConnect(front,object,workspace)
  559. break
  560. end
  561. wait()
  562. end
  563. p:remove()
  564. end))
  565. while (mousedown==true) do
  566. if (mouse.Target~=nil) then
  567. local t = mouse.Target
  568. if (t.Anchored==false) then
  569. object = t
  570. dist = (object.Position-front.Position).magnitude
  571. break
  572. end
  573. end
  574. wait()
  575. end
  576. while (mousedown==true) do
  577. if (object.Parent==nil) then break end
  578. local lv = CFrame.new(front.Position,mouse.Hit.p)
  579. BP.Parent = object
  580. BP.position = front.Position+lv.lookVector*dist
  581. wait()
  582. end
  583. BP:remove()
  584. object = nil
  585. objval.Value = nil
  586. end
  587.  
  588. function onKeyDown(key,mouse)
  589. local key = key:lower()
  590. local yesh = false
  591. if (key=="q") then
  592. if (dist>=5) then
  593. dist = dist-30
  594. end
  595. end
  596. if key == "" then
  597. if (object==nil) then return end
  598. for _,v in pairs(object:children()) do
  599. if v.className == "BodyGyro" then
  600. return nil
  601. end
  602. end
  603. BG = Instance.new("BodyGyro")
  604. BG.maxTorque = Vector3.new(math.huge,math.huge,math.huge)
  605. BG.cframe = CFrame.new(object.CFrame.p)
  606. BG.Parent = object
  607. repeat wait() until(object.CFrame == CFrame.new(object.CFrame.p))
  608. BG.Parent = nil
  609. if (object==nil) then return end
  610. for _,v in pairs(object:children()) do
  611. if v.className == "BodyGyro" then
  612. v.Parent = nil
  613. end
  614. end
  615. object.Velocity = Vector3.new(0,0,0)
  616. object.RotVelocity = Vector3.new(0,0,0)
  617. end
  618. if (key=="e") then
  619. dist = dist+5
  620. end
  621. if (key=="h") then
  622. if (object==nil) then return end
  623. local e = Instance.new("Explosion")
  624. e.Parent = workspace
  625. e.Position = object.Position
  626. color.BrickColor = BrickColor.Black()
  627. point.BrickColor = BrickColor.White()
  628. wait(.48)
  629. color.BrickColor = BrickColor.White()
  630. point.BrickColor = BrickColor.Black()
  631. end
  632. if (key=="]") then
  633. if not hooked then
  634. if (object==nil) then return end
  635. hooked = true
  636. hookBP.position = object.Position
  637. if tool.Parent:findFirstChild("Torso") then
  638. hookBP.Parent = tool.Parent.Torso
  639. if dist ~= (object.Size.x+object.Size.y+object.Size.z)+5 then
  640. dist = (object.Size.x+object.Size.y+object.Size.z)+5
  641. end
  642. end
  643. else
  644. hooked = false
  645. hookBP.Parent = nil
  646. end
  647. end
  648. if (key=="r") then
  649. if (dist<=30) then
  650. dist = dist+30
  651. end
  652. end
  653. if (key=="b") then
  654. if (object==nil) then return end
  655. local New = object:clone()
  656. New.Parent = object.Parent
  657. for _,v in pairs(New:children()) do
  658. if v.className == "BodyPosition" or v.className == "BodyGyro" then
  659. v.Parent = nil
  660. end
  661. end
  662. object = New
  663. mousedown = false
  664. mousedown = true
  665. LineConnect(front,object,workspace)
  666. while (mousedown==true) do
  667. if (object.Parent==nil) then break end
  668. local lv = CFrame.new(front.Position,mouse.Hit.p)
  669. BP.Parent = object
  670. BP.position = front.Position+lv.lookVector*dist
  671. wait()
  672. end
  673. BP:remove()
  674. object = nil
  675. objval.Value = nil
  676. end
  677. if (key=="c") then
  678. local Cube = Instance.new("Part")
  679. Cube.Locked = true
  680. Cube.Size = Vector3.new(4,4,4)
  681. Cube.formFactor = 0
  682. Cube.TopSurface = 0
  683. Cube.BottomSurface = 0
  684. Cube.Name = "WeightedStorageCube"
  685. Cube.Parent = workspace
  686. Cube.CFrame = CFrame.new(mouse.Hit.p) + Vector3.new(0,2,0)
  687. for i = 0,5 do
  688. local Decal = Instance.new("Decal")
  689. Decal.Texture = "http://www.roblox.com/asset/?id=2662260"
  690. Decal.Face = i
  691. Decal.Name = "WeightedStorageCubeDecal"
  692. Decal.Parent = Cube
  693. end
  694. end
  695. if (key=="[") then
  696. if dist ~= 15 then
  697. dist = 15
  698. end
  699. end
  700. end
  701.  
  702. function onEquipped(mouse)
  703. keymouse = mouse
  704. local char = tool.Parent
  705. human = char.Humanoid
  706. human.Changed:connect(function() if (human.Health==0) then mousedown = false BP:remove() point:remove() tool:remove() end end)
  707. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  708. mouse.Button1Up:connect(function() mousedown = false end)
  709. mouse.KeyDown:connect(function(key) onKeyDown(key,mouse) end)
  710. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  711. end
  712.  
  713. tool.Equipped:connect(onEquipped)
  714. end))
  715. LocalScript5.Name = "LineConnect"
  716. LocalScript5.Parent = Tool0
  717. LocalScript5.Disabled = true
  718. table.insert(cors,sandbox(LocalScript5,function()
  719. wait()
  720. local check = script.Part2
  721. local part1 = script.Part1.Value
  722. local part2 = script.Part2.Value
  723. local parent = script.Par.Value
  724. local color = script.Color
  725. local line = Instance.new("Part")
  726. line.TopSurface = 0
  727. line.BottomSurface = 0
  728. line.Reflectance = .5
  729. line.Name = "Laser"
  730. line.Locked = true
  731. line.CanCollide = false
  732. line.Anchored = true
  733. line.formFactor = 0
  734. line.Size = Vector3.new(0.3,0.3,1)
  735. local mesh = Instance.new("BlockMesh")
  736. mesh.Parent = line
  737. while true do
  738. if (check.Value==nil) then break end
  739. if (part1==nil or part2==nil or parent==nil) then break end
  740. if (part1.Parent==nil or part2.Parent==nil) then break end
  741. if (parent.Parent==nil) then break end
  742. local lv = CFrame.new(part1.Position,part2.Position)
  743. local dist = (part1.Position-part2.Position).magnitude
  744. line.Parent = parent
  745. line.Material = "Neon"
  746. line.BrickColor = color.Value.BrickColor
  747. line.Reflectance = color.Value.Reflectance
  748. line.Transparency = "0.2"
  749. line.CFrame = CFrame.new(part1.Position+lv.lookVector*dist/2)
  750. line.CFrame = CFrame.new(line.Position,part2.Position)
  751. mesh.Scale = Vector3.new(.25,.25,dist)
  752. wait()
  753. end
  754. line:remove()
  755. script:remove()
  756. end))
  757. Part6.Name = "Shoot"
  758. Part6.Parent = Tool0
  759. Part6.Material = Enum.Material.Neon
  760. Part6.BrickColor = BrickColor.new("Toothpaste")
  761. Part6.Rotation = Vector3.new(-90, -0.00999999978, -90)
  762. Part6.CanCollide = false
  763. Part6.FormFactor = Enum.FormFactor.Custom
  764. Part6.Shape = Enum.PartType.Cylinder
  765. Part6.Size = Vector3.new(0.0899999961, 0.191250086, 0.224999964)
  766. Part6.CFrame = CFrame.new(118.000183, 39.6357117, -41.878067, 0, 1, -9.89999971e-05, 6.60000005e-05, 9.89999971e-05, 1, 1, -6.53400001e-09, -6.60000005e-05)
  767. Part6.BottomSurface = Enum.SurfaceType.Smooth
  768. Part6.TopSurface = Enum.SurfaceType.Smooth
  769. Part6.Color = Color3.new(0, 1, 1)
  770. Part6.Position = Vector3.new(118.000183, 39.6357117, -41.878067)
  771. Part6.Orientation = Vector3.new(-90, -90, 0)
  772. Part6.Color = Color3.new(0, 1, 1)
  773. for i,v in pairs(mas:GetChildren()) do
  774. v.Parent = game:GetService("Players").LocalPlayer.Backpack
  775. pcall(function() v:MakeJoints() end)
  776. end
  777. mas:Destroy()
  778. for i,v in pairs(cors) do
  779. spawn(function()
  780. pcall(v)
  781. end)
  782. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement