Advertisement
MyNewName

Untitled

Mar 14th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.02 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 p2 = Instance.new("ObjectValue")
  524. p2.Value = part2
  525. p2.Name = "Part2"
  526. local par = Instance.new("ObjectValue")
  527. par.Value = parent
  528. par.Name = "Par"
  529. local col = Instance.new("ObjectValue")
  530. col.Value = color
  531. col.Name = "Color"
  532. local s = lineconnect:Clone()
  533. s.Name = "LineConnectClone"
  534. s.Disabled = false
  535. p1.Parent = s
  536. p2.Parent = s
  537. par.Parent = s
  538. col.Parent = s
  539. s.Parent = tool
  540. if (part2==object) then
  541. objval = p2
  542. end
  543. end
  544.  
  545. function onButton1Down(mouse)
  546. if (mousedown==true) then return end
  547. mousedown = true
  548. coroutine.resume(coroutine.create(function()
  549. local p = point:clone()
  550. p.Parent = tool
  551. LineConnect(front,object,workspace)
  552. while (mousedown==true) do
  553. p.Parent = tool
  554. if (object==nil) then
  555. if (mouse.Target==nil) then
  556. local lv = CFrame.new(front.Position,mouse.Hit.p)
  557. p.CFrame = CFrame.new(front.Position+(lv.lookVector*1000))
  558. else
  559. p.CFrame = CFrame.new(mouse.Hit.p)
  560. end
  561. else
  562. LineConnect(front,object,workspace)
  563. break
  564. end
  565. wait()
  566. end
  567. p:remove()
  568. end))
  569. while (mousedown==true) do
  570. if (mouse.Target~=nil) then
  571. local t = mouse.Target
  572. if (t.Anchored==false) then
  573. object = t
  574. dist = (object.Position-front.Position).magnitude
  575. break
  576. end
  577. end
  578. wait()
  579. end
  580. while (mousedown==true) do
  581. if (object.Parent==nil) then break end
  582. local lv = CFrame.new(front.Position,mouse.Hit.p)
  583. BP.Parent = object
  584. BP.position = front.Position+lv.lookVector*dist
  585. wait()
  586. end
  587. BP:remove()
  588. object = nil
  589. objval.Value = nil
  590. end
  591.  
  592. function onKeyDown(key,mouse)
  593. local key = key:lower()
  594. local yesh = false
  595. if (key=="q") then
  596. if (dist>=5) then
  597. dist = dist-30
  598. end
  599. end
  600. if key == "" then
  601. if (object==nil) then return end
  602. for _,v in pairs(object:children()) do
  603. if v.className == "BodyGyro" then
  604. return nil
  605. end
  606. end
  607. BG = Instance.new("BodyGyro")
  608. BG.maxTorque = Vector3.new(math.huge,math.huge,math.huge)
  609. BG.cframe = CFrame.new(object.CFrame.p)
  610. BG.Parent = object
  611. repeat wait() until(object.CFrame == CFrame.new(object.CFrame.p))
  612. BG.Parent = nil
  613. if (object==nil) then return end
  614. for _,v in pairs(object:children()) do
  615. if v.className == "BodyGyro" then
  616. v.Parent = nil
  617. end
  618. end
  619. object.Velocity = Vector3.new(0,0,0)
  620. object.RotVelocity = Vector3.new(0,0,0)
  621. end
  622. if (key=="e") then
  623. dist = dist+5
  624. end
  625. if (key=="h") then
  626. if (object==nil) then return end
  627. local e = Instance.new("Explosion")
  628. e.Parent = workspace
  629. e.Position = object.Position
  630. color.BrickColor = BrickColor.Black()
  631. point.BrickColor = BrickColor.White()
  632. wait(.48)
  633. color.BrickColor = BrickColor.White()
  634. point.BrickColor = BrickColor.Black()
  635. end
  636. if (key=="]") then
  637. if not hooked then
  638. if (object==nil) then return end
  639. hooked = true
  640. hookBP.position = object.Position
  641. if tool.Parent:findFirstChild("Torso") then
  642. hookBP.Parent = tool.Parent.Torso
  643. if dist ~= (object.Size.x+object.Size.y+object.Size.z)+5 then
  644. dist = (object.Size.x+object.Size.y+object.Size.z)+5
  645. end
  646. end
  647. else
  648. hooked = false
  649. hookBP.Parent = nil
  650. end
  651. end
  652. if (key=="r") then
  653. if (dist<=30) then
  654. dist = dist+30
  655. end
  656. end
  657. if (key=="b") then
  658. if (object==nil) then return end
  659. local New = object:clone()
  660. New.Parent = object.Parent
  661. for _,v in pairs(New:children()) do
  662. if v.className == "BodyPosition" or v.className == "BodyGyro" then
  663. v.Parent = nil
  664. end
  665. end
  666. object = New
  667. mousedown = false
  668. mousedown = true
  669. LineConnect(front,object,workspace)
  670. while (mousedown==true) do
  671. if (object.Parent==nil) then break end
  672. local lv = CFrame.new(front.Position,mouse.Hit.p)
  673. BP.Parent = object
  674. BP.position = front.Position+lv.lookVector*dist
  675. wait()
  676. end
  677. BP:remove()
  678. object = nil
  679. objval.Value = nil
  680. end
  681. if (key=="c") then
  682. local Cube = Instance.new("Part")
  683. Cube.Locked = true
  684. Cube.Size = Vector3.new(4,4,4)
  685. Cube.formFactor = 0
  686. Cube.TopSurface = 0
  687. Cube.BottomSurface = 0
  688. Cube.Name = "WeightedStorageCube"
  689. Cube.Parent = workspace
  690. Cube.CFrame = CFrame.new(mouse.Hit.p) + Vector3.new(0,2,0)
  691. for i = 0,5 do
  692. local Decal = Instance.new("Decal")
  693. Decal.Texture = "http://www.roblox.com/asset/?id=2662260"
  694. Decal.Face = i
  695. Decal.Name = "WeightedStorageCubeDecal"
  696. Decal.Parent = Cube
  697. end
  698. end
  699. if (key=="[") then
  700. if dist ~= 15 then
  701. dist = 15
  702. end
  703. end
  704. end
  705.  
  706. function onEquipped(mouse)
  707. keymouse = mouse
  708. local char = tool.Parent
  709. human = char.Humanoid
  710. human.Changed:connect(function() if (human.Health==0) then mousedown = false BP:remove() point:remove() tool:remove() end end)
  711. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  712. mouse.Button1Up:connect(function() mousedown = false end)
  713. mouse.KeyDown:connect(function(key) onKeyDown(key,mouse) end)
  714. mouse.Icon = "rbxasset://textures\\GunCursor.png"
  715. end
  716.  
  717. tool.Equipped:connect(onEquipped)
  718. end))
  719. LocalScript5.Name = "LineConnect"
  720. LocalScript5.Parent = Tool0
  721. LocalScript5.Disabled = true
  722. table.insert(cors,sandbox(LocalScript5,function()
  723. wait()
  724. local check = script.Part2
  725. local part1 = script.Part1.Value
  726. local part2 = script.Part2.Value
  727. local parent = script.Par.Value
  728. local color = script.Color
  729. local line = Instance.new("Part")
  730. line.TopSurface = 0
  731. line.BottomSurface = 0
  732. line.Reflectance = .5
  733. line.Name = "Laser"
  734. line.Locked = true
  735. line.CanCollide = false
  736. line.Anchored = true
  737. line.formFactor = 0
  738. line.Size = Vector3.new(0.3,0.3,1)
  739. local mesh = Instance.new("BlockMesh")
  740. mesh.Parent = line
  741. while true do
  742. if (check.Value==nil) then break end
  743. if (part1==nil or part2==nil or parent==nil) then break end
  744. if (part1.Parent==nil or part2.Parent==nil) then break end
  745. if (parent.Parent==nil) then break end
  746. local lv = CFrame.new(part1.Position,part2.Position)
  747. local dist = (part1.Position-part2.Position).magnitude
  748. line.Parent = parent
  749. line.Material = "Neon"
  750. line.BrickColor = color.Value.BrickColor
  751. line.Reflectance = color.Value.Reflectance
  752. line.Transparency = "0.2"
  753. line.CFrame = CFrame.new(part1.Position+lv.lookVector*dist/2)
  754. line.CFrame = CFrame.new(line.Position,part2.Position)
  755. mesh.Scale = Vector3.new(.25,.25,dist)
  756. wait()
  757. end
  758. line:remove()
  759. script:remove()
  760. end))
  761. Part6.Name = "Shoot"
  762. Part6.Parent = Tool0
  763. Part6.Material = Enum.Material.Neon
  764. Part6.BrickColor = BrickColor.new("Toothpaste")
  765. Part6.Rotation = Vector3.new(-90, -0.00999999978, -90)
  766. Part6.CanCollide = false
  767. Part6.FormFactor = Enum.FormFactor.Custom
  768. Part6.Shape = Enum.PartType.Cylinder
  769. Part6.Size = Vector3.new(0.0899999961, 0.191250086, 0.224999964)
  770. 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)
  771. Part6.BottomSurface = Enum.SurfaceType.Smooth
  772. Part6.TopSurface = Enum.SurfaceType.Smooth
  773. Part6.Color = Color3.new(0, 1, 1)
  774. Part6.Position = Vector3.new(118.000183, 39.6357117, -41.878067)
  775. Part6.Orientation = Vector3.new(-90, -90, 0)
  776. Part6.Color = Color3.new(0, 1, 1)
  777. for i,v in pairs(mas:GetChildren()) do
  778. v.Parent = workspace
  779. pcall(function() v:MakeJoints() end)
  780. end
  781. mas:Destroy()
  782. for i,v in pairs(cors) do
  783. spawn(function()
  784. pcall(v)
  785. end)
  786. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement