awzp

Xsoulstealers gui (not by me ofc)

May 31st, 2018
350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 63.52 KB | None | 0 0
  1. Player = game.Players.LocalPlayer
  2. PlayerGui = Player.PlayerGui
  3. Screen = Instance.new("ScreenGui", PlayerGui)
  4. rope = Instance.new("TextButton", Screen)
  5. rope.Position = UDim2.new(0, 0, 0, 300)
  6. rope.Size = UDim2.new(0, 100, 0, 50)
  7. rope.Text = "Rope Swing"
  8. rope.MouseButton1Down:connect(function()
  9. SETTINGS = {}
  10. SETTINGS.GRAVITY = 196.2*1
  11.  
  12.  
  13.  
  14.  
  15. user = game.Players.LocalPlayer
  16.  
  17. repeat wait() until user.Character
  18.  
  19. char = user.Character
  20. mouse = user:GetMouse()
  21. l_arm = char:WaitForChild("Left Arm")
  22. r_arm = char:WaitForChild("Right Arm")
  23. l_leg = char:WaitForChild("Left Leg")
  24. r_leg = char:WaitForChild("Right Leg")
  25. head = char:WaitForChild("Head")
  26.  
  27. Points = {}
  28. Constraints = {}
  29.  
  30.  
  31.  
  32. Point = {}
  33.  
  34. Point.new = function( x, y, z )
  35. local self = setmetatable( {}, { __index = Point } )
  36.  
  37. self.x = x
  38. self.y = y
  39. self.z = z
  40.  
  41. self.prevX = x
  42. self.prevY = y
  43. self.prevZ = z
  44.  
  45. self.velX = 0
  46. self.velY = 0
  47. self.velZ = 0
  48.  
  49. self.accX = 0
  50. self.accY = 0
  51. self.accZ = 0
  52.  
  53. self.forceX = 0
  54. self.forceY = 0
  55. self.forceZ = 0
  56.  
  57. self.pinned = false
  58. self.mass = 1
  59.  
  60. return self
  61. end
  62.  
  63. Point.update = function( self, delta )
  64.  
  65. if not self.pinned then
  66. self.accX = 0
  67. self.accY = -SETTINGS.GRAVITY
  68. self.accZ = 0
  69.  
  70. self.velX = ( self.x - self.prevX + self.forceX ) --* delta * 30
  71. self.velY = ( self.y - self.prevY + self.forceY ) --* delta * 30
  72. self.velZ = ( self.z - self.prevZ + self.forceZ ) --* delta * 30
  73.  
  74. local nextX = self.x + self.velX*0.9985 + self.accX * delta^2
  75. local nextY = self.y + self.velY*0.9985 + self.accY * delta^2
  76. local nextZ = self.z + self.velZ*0.9985 + self.accZ * delta^2
  77.  
  78. self.prevX = self.x
  79. self.prevY = self.y
  80. self.prevZ = self.z
  81.  
  82. self.x = nextX
  83. self.y = nextY
  84. self.z = nextZ
  85. else
  86. self.accX = 0
  87. self.accY = 0
  88. self.accZ = 0
  89.  
  90. self.velX = 0
  91. self.velY = 0
  92. self.velZ = 0
  93.  
  94. self.prevX = self.x
  95. self.prevY = self.y
  96. self.prevZ = self.z
  97. end
  98.  
  99. self.forceX = 0
  100. self.forceY = 0
  101. self.forceZ = 0
  102. end
  103.  
  104. Point.setPinned = function(self, pinned)
  105. self.pinned = pinned
  106. end
  107.  
  108. Point.setMass = function(self, mass)
  109. self.mass = mass
  110. end
  111.  
  112. Point.getPosition = function( self )
  113. return Vector3.new( self.x, self.y, self.z )
  114. end
  115.  
  116. Point.setPosition = function( self, pos )
  117. self.x = pos.x
  118. self.y = pos.y
  119. self.z = pos.z
  120. end
  121.  
  122. Point.setForce = function(self, fx, fy, fz)
  123. self.forceX = fx
  124. self.forceY = fy
  125. self.forceZ = fz
  126. end
  127.  
  128. Point.isPinned = function(self)
  129. return self.pinned
  130. end
  131.  
  132.  
  133.  
  134. Constraint = {}
  135.  
  136. Constraint.new = function( point1, point2, dist )
  137. local self = setmetatable( {}, { __index = Constraint } )
  138.  
  139. self.point1 = point1
  140. self.point2 = point2
  141.  
  142. self.desireddistance = dist
  143.  
  144. self.line = Instance.new("Part", Game.Workspace)
  145. self.line.CanCollide = false
  146. self.line.FormFactor = "Custom"
  147. self.line.Size = Vector3.new( .2, .2, .2 )
  148. self.line.Anchored = true
  149. self.line.BrickColor = BrickColor.new("Institutional white")
  150.  
  151. self.mesh = Instance.new("BlockMesh", self.line)
  152. self.mesh.Scale = Vector3.new( 0.3, 0.3, 5 ) / 0.2
  153.  
  154. return self
  155. end
  156.  
  157.  
  158.  
  159. Constraint.solve = function( self )
  160. if not self:isDisconnected() then
  161. local diffX = self.point1.x - self.point2.x
  162. local diffY = self.point1.y - self.point2.y
  163. local diffZ = self.point1.z - self.point2.z
  164.  
  165. local dist = math.sqrt( diffX^2 + diffY^2 + diffZ^2 )
  166.  
  167. local difference = ( self.desireddistance - dist ) / dist
  168.  
  169. local massratio = self.point1.mass/self.point2.mass --?
  170.  
  171. local translateX = diffX * 0.5 * difference
  172. local translateY = diffY * 0.5 * difference
  173. local translateZ = diffZ * 0.5 * difference
  174.  
  175. if not self.point1.pinned then
  176. self.point1.x = self.point1.x + translateX
  177. self.point1.y = self.point1.y + translateY
  178. self.point1.z = self.point1.z + translateZ
  179. end
  180.  
  181. if not self.point2.pinned then
  182. self.point2.x = self.point2.x - translateX
  183. self.point2.y = self.point2.y - translateY
  184. self.point2.z = self.point2.z - translateZ
  185. end
  186. end
  187. end
  188.  
  189. Constraint.draw = function( self )
  190. if not self:isDisconnected() and self.line and self.mesh then
  191. local dist = math.sqrt(
  192. ( self.point1.x - self.point2.x )^2 +
  193. ( self.point1.y - self.point2.y )^2 +
  194. ( self.point1.z - self.point2.z )^2
  195. )
  196.  
  197. self.line.CFrame = CFrame.new(
  198. Vector3.new( self.point1.x, self.point1.y, self.point1.z ),
  199. Vector3.new( self.point2.x, self.point2.y, self.point2.z )
  200. ) * CFrame.new( 0, 0, - dist / 2 )
  201.  
  202. self.mesh.Scale = Vector3.new( 0.3, 0.3, dist ) / 0.2
  203. end
  204. end
  205.  
  206. Constraint.remove = function( self )
  207. if self.line then self.line:Destroy() self.line = nil end
  208. if self.mesh then self.mesh:Destroy() self.mesh = nil end
  209. self.point1 = nil
  210. self.point2 = nil
  211. end
  212.  
  213. Constraint.isDisconnected = function( self )
  214. return not (self.point1 and self.point2)
  215. end
  216.  
  217. Constraint.setDistance = function( self, dist )
  218. self.desireddistance = dist
  219. end
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229. char_point = Point.new( 0, 100, 0 )
  230.  
  231. for _,v in pairs(char.Torso:children()) do
  232. if v:IsA("Motor6D") and v.Name ~= "Neck" then
  233. v:Destroy()
  234. end
  235. end
  236. for _,v in pairs(char:children()) do
  237. if v:IsA("BasePart") then
  238. v.Anchored = true
  239. end
  240. end
  241.  
  242. ragdoll = {}
  243.  
  244. ragdoll.l_shoulder = Point.new( 0, 0, 0 )
  245. ragdoll.r_shoulder = Point.new( 0, 0, 0 )
  246. ragdoll.l_hip = Point.new( 0, 0, 0 )
  247. ragdoll.r_hip = Point.new( 0, 0, 0 )
  248.  
  249. ragdoll.l_shoulder:setPinned( true )
  250. ragdoll.r_shoulder:setPinned( true )
  251. ragdoll.l_hip:setPinned( true )
  252. ragdoll.r_hip:setPinned( true )
  253.  
  254. ragdoll.l_arm = Point.new( 0, -2, 0 )
  255. ragdoll.r_arm = Point.new( 0, -2, 0 )
  256. ragdoll.l_leg = Point.new( 0, -2, 0 )
  257. ragdoll.r_leg = Point.new( 0, -2, 0 )
  258.  
  259. local l_arm_w = Constraint.new(ragdoll.l_shoulder, ragdoll.l_arm, 2)
  260. local r_arm_w = Constraint.new(ragdoll.r_shoulder, ragdoll.r_arm, 2)
  261. local l_leg_w = Constraint.new(ragdoll.l_hip, ragdoll.l_leg, 2)
  262. local r_leg_w = Constraint.new(ragdoll.r_hip, ragdoll.r_leg, 2)
  263.  
  264.  
  265.  
  266. firstpoint = nil
  267. attachpoint = nil
  268. attachpart = nil
  269. attachoffset = Vector3.new()
  270.  
  271. length = 8
  272.  
  273. webshot = false
  274. local pointbool = false
  275.  
  276. function shoot( from, to )
  277. if not webshot then
  278. local hit, hitpos = workspace:FindPartOnRay(Ray.new( from, (to-from).unit*999 ), char)
  279. if hit then
  280. webshot = true
  281. to = hitpos
  282. for _,v in pairs(Constraints) do
  283. v:remove()
  284. end
  285.  
  286. attachpart = hit
  287. attachoffset = attachpart.CFrame:pointToObjectSpace( hitpos )
  288.  
  289. length = 8
  290.  
  291. Constraints = {}
  292. Points = {}
  293.  
  294. local dir = ( to - from ).unit
  295. local dist = ( to - from ).magnitude
  296. if dist > 1000 then
  297. dist = 1000
  298. to = from + dir*1000
  299. end
  300.  
  301. pointbool = true
  302.  
  303. local amnt = math.floor( dist/length )
  304. amnt = amnt < 2 and 2 or amnt
  305. local temp = {}
  306.  
  307. for y = 1, amnt do
  308. local pos = from:Lerp( to, y/amnt )
  309.  
  310. local rx, ry, rz = ( math.random()-0.5 )*2, ( math.random()-0.5 )*2, ( math.random()-0.5 )*2
  311. temp[y] = Point.new( pos.x+rx, pos.y+ry, pos.z+rz)
  312.  
  313. if y ~= 1 then
  314. table.insert(Constraints, Constraint.new(temp[y-1], temp[y], length*1) )
  315. else
  316. firstpoint = temp[y]
  317. table.insert(Constraints, Constraint.new(char_point, firstpoint, 1) )
  318. end
  319.  
  320. if y == amnt then
  321. temp[y]:setPinned(true)
  322. attachpoint = temp[y]
  323. end
  324. end
  325.  
  326. for _,p in pairs(temp) do
  327. table.insert(Points, p)
  328. end
  329. end
  330. else
  331. attachpart = nil
  332. attachpoint = nil
  333. attachoffset = Vector3.new()
  334.  
  335. webshot = false
  336. for _,v in pairs(Constraints) do
  337. v:remove()
  338. end
  339.  
  340. Constraints = {}
  341. Points = {}
  342.  
  343. end
  344. end
  345.  
  346. keys = {}
  347.  
  348. mouse.Button1Down:connect(function()
  349. shoot( Vector3.new(char_point.x, char_point.y, char_point.z ), mouse.Hit.p )
  350. end)
  351.  
  352. mouse.KeyDown:connect(function(key)
  353. keys[ string.byte(key) ] = true
  354. end)
  355. mouse.KeyUp:connect(function(key)
  356. keys[ string.byte(key) ] = false
  357. end)
  358.  
  359. prevtime = tick()
  360.  
  361. function loop( )
  362. local delta = tick()-prevtime
  363. prevtime = tick()
  364.  
  365. if keys[32] then
  366. length = length - 0.1*30*delta
  367. if length < 2 then length = 2 end
  368. end
  369. if keys[48] then
  370. length = length + 0.1*30*delta
  371. if length > 11 then length = 11 end
  372. end
  373.  
  374. if attachpart and attachpoint then
  375. local po = attachpart.CFrame * attachoffset
  376. attachpoint.x = po.x
  377. attachpoint.y = po.y
  378. attachpoint.z = po.z
  379. end
  380.  
  381. char_point:update( delta )
  382. if char_point.y < -150 then
  383. char_point = Point.new( 0, 150, 0 )
  384. end
  385.  
  386. if pointbool then
  387. for _,p in pairs(Points) do
  388. p:setForce( char_point.velX*0.9, char_point.velY*0.9, char_point.velZ*0.9 )
  389. end
  390. pointbool = false
  391. end
  392.  
  393. for _,p in pairs(Points) do
  394. p:update( delta )
  395. end
  396.  
  397. for _,v in pairs(char:children()) do
  398. if v:IsA("BasePart") then
  399. v.Velocity = Vector3.new()
  400. v.RotVelocity = Vector3.new()
  401. end
  402. end
  403.  
  404. if firstpoint then
  405. char.Torso.CFrame = CFrame.new(
  406. Vector3.new(char_point.x, char_point.y, char_point.z),
  407. Vector3.new(firstpoint.x, firstpoint.y, firstpoint.z)
  408. ) * CFrame.Angles(math.rad(-90), 0, 0)
  409. else
  410. char.Torso.CFrame = CFrame.new( char_point.x, char_point.y, char_point.z )
  411. end
  412. head.CFrame = char.Torso.CFrame * CFrame.new( 0, 1.5, 0 )
  413. for _,c in pairs(Constraints) do
  414. c:setDistance( length )
  415. end
  416.  
  417. local tcf = char.Torso.CFrame
  418. ragdoll.l_shoulder:setPosition( tcf*CFrame.new( -1.5, 0.5, 0 ).p )
  419. ragdoll.r_shoulder:setPosition( tcf*CFrame.new( 1.5, 0.5, 0 ).p )
  420. ragdoll.l_hip:setPosition( tcf*CFrame.new( -0.5, -1, 0 ).p )
  421. ragdoll.r_hip:setPosition( tcf*CFrame.new( 0.5, -1, 0 ).p )
  422.  
  423. for _,v in pairs(ragdoll) do
  424. v:update( delta*0.93 )
  425. end
  426.  
  427. for i = 1, 15 do
  428. for _,c in pairs(Constraints) do
  429. c:solve()
  430. end
  431. l_arm_w:solve()
  432. r_arm_w:solve()
  433. l_leg_w:solve()
  434. r_leg_w:solve()
  435. end
  436. for _,c in pairs(Constraints) do
  437. c:draw()
  438. end
  439.  
  440. l_arm.CFrame = CFrame.new( ragdoll.l_shoulder:getPosition(), ragdoll.l_arm:getPosition() ) * CFrame.Angles(math.pi/2, 0, 0) * CFrame.new( 0, -0.5, 0 )
  441. r_arm.CFrame = CFrame.new( ragdoll.r_shoulder:getPosition(), ragdoll.r_arm:getPosition() ) * CFrame.Angles(math.pi/2, 0, 0) * CFrame.new( 0, -0.5, 0 )
  442. l_leg.CFrame = CFrame.new( ragdoll.l_hip:getPosition(), ragdoll.l_leg:getPosition() ) * CFrame.Angles(math.pi/2, 0, 0) * CFrame.new( 0, -1, 0 )
  443. r_leg.CFrame = CFrame.new( ragdoll.r_hip:getPosition(), ragdoll.r_leg:getPosition() ) * CFrame.Angles(math.pi/2, 0, 0) * CFrame.new( 0, -1, 0 )
  444.  
  445. end
  446.  
  447. game:getService("RunService").Stepped:connect(loop)
  448. end)
  449. elas = Instance.new("TextButton", Screen)
  450. elas.Position = UDim2.new(0, 0, 0, 350)
  451. elas.Size = UDim2.new(0, 100, 0, 50)
  452. elas.Text = "Elastic Block"
  453. elas.MouseButton1Down:connect(function()
  454. SETTINGS = {}
  455. SETTINGS.GRAVITY = 196.2*1
  456.  
  457.  
  458.  
  459.  
  460. user = game.Players.LocalPlayer
  461.  
  462. repeat wait() until user.Character
  463.  
  464. playergui = user.PlayerGui
  465. screengui = Instance.new("ScreenGui", playergui)
  466. screengui.Name = "xSoul Physics Sandbox"
  467. camera = workspace.CurrentCamera
  468.  
  469. function screenToWorld(x,y)
  470. local viewsize = screengui.AbsoluteSize/2
  471. local a = math.tan(camera.FieldOfView*math.pi/360)
  472. local bx = (viewsize.x-x)/viewsize.x*(a*viewsize.X/viewsize.Y)
  473. local by = (viewsize.y-y)/viewsize.y*a
  474. return camera.CoordinateFrame:vectorToWorldSpace(Vector3.new(-bx,by,-1).unit)
  475. end
  476.  
  477. char = user.Character
  478. mouse = user:GetMouse()
  479.  
  480. SavedPoints = {}
  481. SavedConstraints = {}
  482.  
  483. Points = {}
  484. Constraints = {}
  485.  
  486. Point = {}
  487.  
  488. Point.new = function( x, y, z )
  489. local self = setmetatable( {}, { __index = Point } )
  490.  
  491. self.x = x
  492. self.y = y
  493. self.z = z
  494.  
  495. self.prevX = x
  496. self.prevY = y
  497. self.prevZ = z
  498.  
  499. self.velX = 0
  500. self.velY = 0
  501. self.velZ = 0
  502.  
  503. self.accX = 0
  504. self.accY = 0
  505. self.accZ = 0
  506.  
  507. self.forceX = 0
  508. self.forceY = 0
  509. self.forceZ = 0
  510.  
  511. self.pinned = false
  512. self.renderable = true
  513. self.renderstate = true
  514.  
  515. self.part = Instance.new("Part")
  516. self.part.FormFactor = "Custom"
  517. self.part.Size = Vector3.new(1,1,1)*0.2
  518. self.part.Anchored = true
  519. self.part.Parent = self.renderable and workspace or nil
  520.  
  521. self.mesh = Instance.new("SpecialMesh",self.part)
  522. self.mesh.MeshType = "Sphere"
  523. self.mesh.Scale = Vector3.new(0.7, 0.7, 0.7)/0.2
  524.  
  525. return self
  526. end
  527.  
  528. Point.update = function( self, delta )
  529.  
  530. if not self.pinned then
  531. self.accX = 0
  532. self.accY = -SETTINGS.GRAVITY
  533. self.accZ = 0
  534.  
  535. self.velX = ( self.x - self.prevX + self.forceX ) --* delta * 30
  536. self.velY = ( self.y - self.prevY + self.forceY ) --* delta * 30
  537. self.velZ = ( self.z - self.prevZ + self.forceZ ) --* delta * 30
  538.  
  539. if self.y <= 0.8 then
  540. self.velX = self.velX * 0.35
  541. self.velZ = self.velZ * 0.35
  542.  
  543. self.velY = math.abs( self.velY )*0.93
  544. self.accY = SETTINGS.GRAVITY*(#Points-1)
  545. end
  546.  
  547. local nextX = self.x + self.velX*0.999 + self.accX * delta^2
  548. local nextY = self.y + self.velY*0.999 + self.accY * delta^2
  549. local nextZ = self.z + self.velZ*0.999 + self.accZ * delta^2
  550.  
  551. self.prevX = self.x
  552. self.prevY = self.y
  553. self.prevZ = self.z
  554.  
  555. self.x = nextX
  556. self.y = nextY
  557. self.z = nextZ
  558. else
  559. self.accX = 0
  560. self.accY = 0
  561. self.accZ = 0
  562.  
  563. self.velX = 0
  564. self.velY = 0
  565. self.velZ = 0
  566.  
  567. self.prevX = self.x
  568. self.prevY = self.y
  569. self.prevZ = self.z
  570. end
  571.  
  572. self.forceX = 0
  573. self.forceY = 0
  574. self.forceZ = 0
  575. end
  576.  
  577. Point.draw = function(self)
  578. if self.part and self.renderable and self.renderstate then
  579. if self.part.Parent ~= workspace then
  580. self.part.Parent = workspace
  581. end
  582. self.part.CFrame = CFrame.new(self.x, self.y, self.z)
  583. else
  584. if self.part.Parent ~= nil then
  585. self.part.Parent = nil
  586. end
  587. end
  588. end
  589.  
  590. Point.setPinned = function(self, pinned)
  591. self.pinned = pinned
  592. end
  593.  
  594. Point.setForce = function(self, fx, fy, fz)
  595. self.forceX = fx
  596. self.forceY = fy
  597. self.forceZ = fz
  598. end
  599.  
  600. Point.isPinned = function(self)
  601. return self.pinned
  602. end
  603.  
  604. Point.clone = function(self)
  605. local p = Point.new( self.x, self.y, self.z )
  606. p:setPinned( self.pinned )
  607. p.renderable = self.renderable
  608. return p
  609. end
  610.  
  611. Point.destroy = function( self )
  612. if self.part then self.part:Destroy() end
  613. end
  614.  
  615. Point.setRenderState = function( self, renderstate )
  616. if self.renderable then
  617. self.renderstate = renderstate
  618. end
  619. end
  620.  
  621. Constraint = {}
  622.  
  623. Constraint.new = function( point1, point2, dist, renderable )
  624. local self = setmetatable( {}, { __index = Constraint } )
  625.  
  626. self.point1 = point1
  627. self.point2 = point2
  628.  
  629. self.renderable = renderable
  630. self.renderstate = renderable
  631.  
  632. self.desireddistance = dist
  633.  
  634. self.line = Instance.new("Part")
  635. self.line.CanCollide = false
  636. self.line.FormFactor = "Custom"
  637. self.line.Size = Vector3.new( .2, .2, .2 )
  638. self.line.Anchored = true
  639. self.line.BrickColor = BrickColor.new("Institutional white")
  640. self.line.Parent = renderable and workspace or nil
  641.  
  642. self.mesh = Instance.new("BlockMesh", self.line)
  643. self.mesh.Scale = Vector3.new( 0.3, 0.3, 5 ) / 0.2
  644.  
  645. return self
  646. end
  647.  
  648.  
  649.  
  650. Constraint.solve = function( self )
  651. if not self:isDisconnected() then
  652. local diffX = self.point1.x - self.point2.x
  653. local diffY = self.point1.y - self.point2.y
  654. local diffZ = self.point1.z - self.point2.z
  655.  
  656. local dist = math.sqrt( diffX^2 + diffY^2 + diffZ^2 )
  657.  
  658. local difference = ( self.desireddistance - dist ) / dist
  659.  
  660. local translateX = diffX * 0.00045 * difference
  661. local translateY = diffY * 0.00045 * difference
  662. local translateZ = diffZ * 0.00045 * difference
  663.  
  664. if not self.point1.pinned then
  665. self.point1.x = self.point1.x + translateX
  666. self.point1.y = self.point1.y + translateY
  667. self.point1.z = self.point1.z + translateZ
  668. end
  669.  
  670. if not self.point2.pinned then
  671. self.point2.x = self.point2.x - translateX
  672. self.point2.y = self.point2.y - translateY
  673. self.point2.z = self.point2.z - translateZ
  674. end
  675. end
  676. end
  677.  
  678. Constraint.draw = function( self )
  679. if (not self:isDisconnected()) and self.renderable and self.renderstate then
  680. if self.line.Parent ~= workspace then
  681. self.line.Parent = workspace
  682. end
  683.  
  684. local dist = math.sqrt(
  685. ( self.point1.x - self.point2.x )^2 +
  686. ( self.point1.y - self.point2.y )^2 +
  687. ( self.point1.z - self.point2.z )^2
  688. )
  689.  
  690. self.line.CFrame = CFrame.new(
  691. Vector3.new( self.point1.x, self.point1.y, self.point1.z ),
  692. Vector3.new( self.point2.x, self.point2.y, self.point2.z )
  693. ) * CFrame.new( 0, 0, - dist / 2 )
  694.  
  695. self.mesh.Scale = Vector3.new( 0.3, 0.3, dist + 0.3 ) / 0.2
  696. else
  697. if self.line.Parent ~= nil then
  698. self.line.Parent = nil
  699. end
  700. end
  701. end
  702.  
  703. Constraint.isDisconnected = function( self )
  704. return not (self.point1 and self.point2)
  705. end
  706.  
  707. Constraint.setDistance = function( self, dist )
  708. self.desireddistance = dist
  709. end
  710.  
  711. Constraint.clone = function( self )
  712. local c = Constraint.new(self.point1, self.point2, self.desireddistance, self.renderable)
  713. return c
  714. end
  715.  
  716. Constraint.destroy = function( self )
  717. if self.line then self.line:Destroy() end
  718. end
  719.  
  720. Constraint.setRenderState = function( self, renderstate )
  721. if self.renderable then
  722. self.renderstate = renderstate
  723. end
  724. end
  725.  
  726.  
  727. function modify( properties )
  728. for prop, val in pairs(properties) do
  729. if prop ~= 1 then
  730. properties[1][prop] = val
  731. end
  732. end
  733. end
  734.  
  735. function worldToScreen(x,y,z)
  736. local p = Vector3.new(x, y, z)
  737. local pos = camera.CoordinateFrame:pointToObjectSpace(p)
  738. local viewsize = Vector2.new(mouse.ViewSizeX,mouse.ViewSizeY)/2
  739. if pos.Z < 0 then
  740. local a = math.tan(camera.FieldOfView*math.pi/360)
  741. local scale = Vector2.new(a * viewsize.X/viewsize.Y,a)
  742. local b = Vector2.new(-pos.X,pos.Y) / pos.Z
  743. local c = viewsize + viewsize * b / scale
  744. return Vector2.new(math.floor(c.x), math.floor(c.y)), pos.Z
  745. else
  746. return Vector2.new(-100,-100)
  747. end
  748. end
  749.  
  750. settings = {}
  751. settings.point = true
  752. settings.pinnedpoint = false
  753. settings.constraint = false
  754. settings.editmode = true
  755.  
  756. backframe = Instance.new("Frame", screengui)
  757. modify { backframe,
  758. Size = UDim2.new( 0, 256, 0, 128+128 ), Position = UDim2.new(1, -256-16, 0, 16), BorderSizePixel = 3, BorderColor3 = Color3.new(0.68, 0.62, 0.56),
  759. BackgroundColor3 = Color3.new( 0.8, 0.75, 0.6 )
  760. }
  761.  
  762. selectiongui = Instance.new("Frame", screengui)
  763. modify { selectiongui,
  764. Size = UDim2.new(0, 24, 0, 24), Rotation = 45, BackgroundColor3 = Color3.new(0.3, 0.9, 0.1), BorderSizePixel = 4,
  765. Transparency = 0.5, Position = UDim2.new(0, -100, 0, -100), BorderColor3 = Color3.new(0.1, 0.35, 0.05)
  766. }
  767.  
  768. Checkboxes = {}
  769. CheckBox = {}
  770.  
  771. CheckBox.new = function( parent, pos, property, func )
  772. local self = setmetatable( {}, { __index = CheckBox } )
  773. self.position = pos
  774. self.property = property
  775.  
  776. self.gui = Instance.new("ImageButton", parent)
  777. modify{ self.gui,
  778. Size = UDim2.new(0, 32, 0, 32), Position = pos, BackgroundColor3 = Color3.new( 0.93, 0.87, 0.82 ), AutoButtonColor = false,
  779. BorderSizePixel = 3, BorderColor3 = Color3.new(0.72, 0.66, 0.6), Image = settings[property] and "rbxassetid://138510306" or ""
  780. }
  781.  
  782. self.gui.MouseButton1Down:connect( function()
  783. func( self )
  784. end)
  785.  
  786. return self
  787. end
  788.  
  789. CheckBox.set = function(self, asd)
  790. settings[ self.property ] = asd
  791. self.gui.Image = settings[ self.property ] and "rbxassetid://138510306" or ""
  792. end
  793.  
  794. local function typeboxfunc( self )
  795. for _,v in pairs(Checkboxes) do
  796. v:set(false)
  797. end
  798. self:set( not settings[self.property] )
  799. end
  800.  
  801. local function generalboxfunc( self )
  802. self:set( not settings[self.property] )
  803. end
  804.  
  805. local checkbox1 = CheckBox.new( backframe, UDim2.new(0, 8, 0, 8+40*0), "point", typeboxfunc )
  806. local checkbox2 = CheckBox.new( backframe, UDim2.new(0, 8, 0, 8+40*1), "pinnedpoint", typeboxfunc )
  807. local checkbox3 = CheckBox.new( backframe, UDim2.new(0, 8, 0, 8+40*2), "constraint", typeboxfunc )
  808.  
  809. local editbox1 = CheckBox.new( backframe, UDim2.new(0, 8, 0, 8+40*3+10), "editmode", generalboxfunc )
  810.  
  811. table.insert(Checkboxes, checkbox1)
  812. table.insert(Checkboxes, checkbox2)
  813. table.insert(Checkboxes, checkbox3)
  814.  
  815. local text1 = Instance.new("TextLabel", checkbox1.gui)
  816. modify { text1,
  817. TextXAlignment = "Left", TextYAlignment = "Top", Position = UDim2.new( 1, 8, 0, 0 ), Size = UDim2.new(),
  818. Text = "Point", BackgroundTransparency = 1, TextColor3 = Color3.new(), FontSize = "Size18", Font = "SourceSans"
  819. }
  820. local text2 = Instance.new("TextLabel", checkbox2.gui)
  821. modify { text2,
  822. TextXAlignment = "Left", TextYAlignment = "Top", Position = UDim2.new( 1, 8, 0, 0 ), Size = UDim2.new(),
  823. Text = "Pinned point", BackgroundTransparency = 1, TextColor3 = Color3.new(), FontSize = "Size18", Font = "SourceSans"
  824. }
  825. local text3 = Instance.new("TextLabel", checkbox3.gui)
  826. modify { text3,
  827. TextXAlignment = "Left", TextYAlignment = "Top", Position = UDim2.new( 1, 8, 0, 0 ), Size = UDim2.new(),
  828. Text = "Constraint", BackgroundTransparency = 1, TextColor3 = Color3.new(), FontSize = "Size18", Font = "SourceSans"
  829. }
  830. local text4 = Instance.new("TextLabel", editbox1.gui)
  831. modify { text4,
  832. TextXAlignment = "Left", TextYAlignment = "Top", Position = UDim2.new( 1, 8, 0, 0 ), Size = UDim2.new(),
  833. Text = "Edit mode", BackgroundTransparency = 1, TextColor3 = Color3.new(), FontSize = "Size18", Font = "SourceSans"
  834. }
  835.  
  836. paused = false
  837. running = false
  838.  
  839. local startbutton = Instance.new("TextButton", backframe)
  840. modify { startbutton,
  841. Position = UDim2.new(0, 0, 1, 8), Size = UDim2.new(0.5, -4, 0, 32), BackgroundColor3 = Color3.new(0.8, 0.75, 0.6), FontSize = "Size24",
  842. Font = "SourceSans", TextColor3 = Color3.new(), Text = "START", BorderSizePixel = 3, BorderColor3 = Color3.new(0.68, 0.62, 0.56)
  843. }
  844.  
  845. startbutton.MouseButton1Down:connect(function()
  846. if not running then
  847. for i,v in pairs(SavedPoints) do
  848. Points[i] = v:clone()
  849. v:setRenderState( false )
  850. end
  851. for i,v in pairs(SavedConstraints) do
  852. local con = v:clone()
  853. v:setRenderState( false )
  854. for ii, p in pairs(SavedPoints) do
  855. if p == v.point1 then
  856. con.point1 = Points[ii]
  857. elseif p == v.point2 then
  858. con.point2 = Points[ii]
  859. end
  860.  
  861. end
  862. table.insert(Constraints, con)
  863. end
  864. running = true
  865. paused = false
  866. else
  867. paused = not paused
  868. end
  869. startbutton.Text = paused and "RETURN" or "PAUSE"
  870. end)
  871.  
  872. local stopbutton = Instance.new("TextButton", backframe)
  873. modify { stopbutton,
  874. Position = UDim2.new(0.5, 4, 1, 8), Size = UDim2.new(0.5, -4, 0, 32), BackgroundColor3 = Color3.new(0.8, 0.75, 0.6), FontSize = "Size24",
  875. Font = "SourceSans", TextColor3 = Color3.new(), Text = "STOP", BorderSizePixel = 3, BorderColor3 = Color3.new(0.68, 0.62, 0.56)
  876. }
  877. stopbutton.MouseButton1Down:connect(function()
  878. running = false
  879. paused = false
  880. startbutton.Text = "START"
  881. for i,v in pairs(Points) do
  882. v:destroy()
  883. Points[i] = nil
  884. end
  885. for i,v in pairs(Constraints) do
  886. v:destroy()
  887. Constraints[i] = nil
  888. end
  889. for i,v in pairs(SavedPoints) do
  890. v:setRenderState(true)
  891. end
  892. for i,v in pairs(SavedConstraints) do
  893. v:setRenderState(true)
  894. end
  895.  
  896. end)
  897.  
  898. button1down = false
  899. click = false
  900. up = false
  901.  
  902. mouse.Button1Down:connect(function()
  903. button1down = true
  904. click = true
  905. up = false
  906. end)
  907.  
  908. mouse.Button1Up:connect(function()
  909. button1down = false
  910. up = true
  911. end)
  912.  
  913. function cube( x, y, z, size )
  914. local sx = math.random()*size/2+size/2
  915. local sy = math.random()*size/2+size/2
  916. local sz = math.random()*size/2+size/2
  917.  
  918. local blb = Point.new( x-sx, y-sy, z-sz ) blb.renderable = false
  919. local brb = Point.new( x+sx, y-sy, z-sz ) brb.renderable = false
  920. local tlb = Point.new( x-sx, y+sy, z-sz ) tlb.renderable = false
  921. local trb = Point.new( x+sx, y+sy, z-sz ) trb.renderable = false
  922.  
  923. local blf = Point.new( x-sx, y-sy, z+sz ) blf.renderable = false
  924. local brf = Point.new( x+sx, y-sy, z+sz ) brf.renderable = false
  925. local tlf = Point.new( x-sx, y+sy, z+sz ) tlf.renderable = false
  926. local trf = Point.new( x+sx, y+sy, z+sz ) trf.renderable = false
  927.  
  928. local function connect(pp1, pp2, rend)
  929. table.insert( SavedConstraints, Constraint.new( pp1, pp2, math.sqrt( (pp2.x-pp1.x)^2 + (pp2.y-pp1.y)^2 + (pp2.z-pp1.z)^2 ), rend) )
  930. end
  931.  
  932. table.insert(SavedPoints, blb)
  933. table.insert(SavedPoints, brb)
  934. table.insert(SavedPoints, tlb)
  935. table.insert(SavedPoints, trb)
  936. table.insert(SavedPoints, blf)
  937. table.insert(SavedPoints, brf)
  938. table.insert(SavedPoints, tlf)
  939. table.insert(SavedPoints, trf)
  940.  
  941. connect( blb, brb, true ) --front
  942. connect( blb, tlb, true )
  943. connect( brb, trb, true )
  944. connect( tlb, trb, true )
  945.  
  946. connect( blf, brf, true ) --back
  947. connect( blf, tlf, true )
  948. connect( brf, trf, true )
  949. connect( tlf, trf, true )
  950.  
  951. connect( blb, blf, true ) --edges
  952. connect( brb, brf, true )
  953. connect( tlb, tlf, true )
  954. connect( trb, trf, true )
  955.  
  956. connect( blb, trb, false ) --back diagonal
  957. connect( brb, tlb, false ) --back diagonal
  958.  
  959. connect( brf, tlf, false ) --front diagonal
  960. connect( blf, trf, false ) --front diagonal
  961.  
  962. connect( blf, tlb, false ) --left diagonal
  963. connect( blb, tlf, false ) --left diagonal
  964.  
  965. connect( brb, trf, false ) --right diagonal
  966. connect( brf, trb, false ) --right diagonal
  967.  
  968. connect( trb, tlf, false ) -- top diagonal
  969. connect( tlb, trf, false ) -- top diagonal
  970.  
  971. connect( blb, brf, false ) -- bottom diagonal
  972. connect( brb, blf, false ) -- bottom diagonal
  973. end
  974.  
  975. selectedpoint = nil
  976. selecteddist = 20
  977.  
  978. cube( 0, 20, 0, 8)
  979.  
  980. prevtime = tick()
  981.  
  982. function loop( )
  983. local delta = tick()-prevtime
  984. prevtime = tick()
  985. delta = 1/60
  986.  
  987. if running and not paused then
  988. for x = 1, 8 do
  989. for _,p in pairs(Points) do
  990. p:update( delta/8 )
  991. end
  992. for i = 1, 8 do
  993. for _,c in pairs(Constraints) do
  994. c:solve()
  995. end
  996. end
  997. end
  998. end
  999.  
  1000. for _,p in pairs(SavedPoints) do
  1001. p:draw()
  1002. end
  1003.  
  1004. for _,c in pairs(SavedConstraints) do
  1005. c:draw()
  1006. end
  1007. for _,p in pairs(Points) do
  1008. p:draw()
  1009. end
  1010. for _,c in pairs(Constraints) do
  1011. c:draw()
  1012. end
  1013.  
  1014. local tab = nil
  1015.  
  1016. if running then tab = Points else tab = SavedPoints end
  1017.  
  1018. local z = -200
  1019. local poss = Vector2.new(-100, -100)
  1020.  
  1021. for _,p in pairs(tab) do
  1022. local pos, zz = worldToScreen(p.x, p.y, p.z)
  1023. local dist = math.sqrt( (pos.x-mouse.X)^2 + (pos.y-mouse.Y)^2 )
  1024.  
  1025. if not selectedpoint then
  1026. if dist < 24 then
  1027. if zz > z then
  1028. z = zz
  1029. poss = pos
  1030. if click then
  1031. selectedpoint = p
  1032. selecteddist = -zz
  1033. end
  1034. end
  1035. end
  1036. end
  1037. end
  1038.  
  1039. if selectedpoint then
  1040. selectedpoint:setPinned( true )
  1041. selectiongui.BackgroundColor3 = Color3.new( 0.1, 0.6, 0.2 )
  1042. selectiongui.BorderColor3 = Color3.new( 0.03, 0.2, 0.03 )
  1043.  
  1044. local pos, zz = worldToScreen( selectedpoint.x, selectedpoint.y, selectedpoint.z )
  1045. selectiongui.Size = UDim2.new( 0, 16, 0, 16 )
  1046. selectiongui.Position = UDim2.new( 0, pos.x-8, 0, pos.y-8 )
  1047. else
  1048. selectiongui.BorderColor3 = Color3.new(0.1, 0.35, 0.05)
  1049. selectiongui.BackgroundColor3 = Color3.new(0.3, 0.9, 0.1)
  1050.  
  1051. selectiongui.Size = UDim2.new( 0, 24, 0, 24 )
  1052. selectiongui.Position = UDim2.new( 0, poss.x-12, 0, poss.y-12 )
  1053. end
  1054.  
  1055. if button1down and selectedpoint and settings.editmode then
  1056. local pos = camera.CoordinateFrame.p + screenToWorld( mouse.X, mouse.Y ) * selecteddist
  1057. local x, y, z = selectedpoint.x, selectedpoint.y, selectedpoint.z
  1058.  
  1059. local dx, dy, dz = pos.x-x, pos.y-y, pos.z-z
  1060.  
  1061. local d = math.sqrt( dx^2 + dy^2 + dz^2 )
  1062.  
  1063. selectedpoint.x = pos.x
  1064. selectedpoint.y = pos.y
  1065. selectedpoint.z = pos.z
  1066.  
  1067. selectedpoint:setForce( dx, dy, dz )
  1068. end
  1069.  
  1070. if click then
  1071. if running and selectedpoint then
  1072. --local dir = mouse.UnitRay.Direction*1.8
  1073. --selectedpoint:setForce( dir.x, dir.y, dir.z )
  1074. end
  1075. end
  1076.  
  1077. if up and selectedpoint then
  1078. selectedpoint:setPinned( false )
  1079. selectedpoint = nil
  1080. end
  1081.  
  1082. click = false
  1083. up = false
  1084. end
  1085.  
  1086. game:service("RunService").RenderStepped:connect(loop)
  1087. end)
  1088. heli = Instance.new("TextButton", Screen)
  1089. heli.Position = UDim2.new(0, 0, 0, 400)
  1090. heli.Size = UDim2.new(0, 100, 0, 50)
  1091. heli.Text = "Helipack"
  1092. heli.MouseButton1Down:connect(function()
  1093. create = function( tab )
  1094. local obj = Instance.new( tab[1] )
  1095. for i, v in pairs( tab ) do
  1096. if i ~= 1 then
  1097. obj[i] = v
  1098. end
  1099. end
  1100. if obj:IsA("BasePart") then
  1101. obj:breakJoints()
  1102. end
  1103. return obj
  1104. end
  1105.  
  1106. local player = game.Players.LocalPlayer
  1107.  
  1108. repeat wait() until player.Character
  1109.  
  1110. local _sgui = create{ "ScreenGui", Parent = player.PlayerGui, Name = "Controls" }
  1111. local _txt = create{ "TextLabel", Parent = _sgui, Text = "Start/Stop:\t\t\tdouble-tap spacebar\nThrust:\t\t\t\thold spacebar\nTurn character:\trotate camera\nTilt offset:\t\t\tWASD\n\nCaution: may be hard to control for some people\nTip: hold space only when you feel like you need more force upwards",
  1112. BackgroundTransparency = 1, TextColor3 = Color3.new(), Size = UDim2.new(0,0,0,0),
  1113. Position = UDim2.new(0.5, -70, 0, 15), TextWrap = true, TextXAlignment = "Left", TextYAlignment = "Top"
  1114. }
  1115.  
  1116. local character = player.Character
  1117. local humanoid = character:WaitForChild("Humanoid")
  1118. local head = character:WaitForChild("Head")
  1119. local torso = character:WaitForChild("Torso")
  1120. local l_arm = character:WaitForChild("Left Arm")
  1121. local r_arm = character:WaitForChild("Right Arm")
  1122. local l_leg = character:WaitForChild("Left Leg")
  1123. local r_leg = character:WaitForChild("Right Leg")
  1124.  
  1125. game:service("ContentProvider"):Preload("rbxassetid://134145308")
  1126.  
  1127. local heli_sound = create{ "Sound", SoundId = "rbxassetid://134145308", Volume = 0.15, Looped = true }
  1128.  
  1129. local mouse = player:GetMouse()
  1130. local camera = workspace.CurrentCamera
  1131. local bodymass = 0
  1132.  
  1133. local heli_axis_weld;
  1134. local heli_rotor_weld;
  1135. local heli_rotorspeed;
  1136. local heli_rotorrot;
  1137. local heli_targetthrottle;
  1138. local heli_throttle;
  1139.  
  1140. local collision_time;
  1141.  
  1142. local bodyforce;
  1143. local bodygyro;
  1144. local tilt = CFrame.new();
  1145.  
  1146. local fake_l_arm;
  1147. local fake_r_arm;
  1148. local fake_l_leg;
  1149. local fake_r_leg;
  1150. local heli_axeltop;
  1151. local heli_axel;
  1152. local heli_top;
  1153.  
  1154. local getMass;
  1155. local updateMass;
  1156. local openPack;
  1157. local closePack;
  1158.  
  1159. local pack_open = false;
  1160.  
  1161. local lastSpaceTick;
  1162.  
  1163. keys = {}
  1164. framekeys = {}
  1165.  
  1166. mouse.KeyDown:connect( function(key)
  1167. keys[ string.byte(key) ] = true
  1168. framekeys[ string.byte(key) ] = true
  1169. end )
  1170. mouse.KeyUp:connect( function(key)
  1171. keys[ string.byte(key) ] = false
  1172. framekeys[ string.byte(key) ] = false
  1173. end )
  1174.  
  1175. lastSpaceTick = 0
  1176.  
  1177. handleInput = function()
  1178. if keys[32] == true then
  1179. heli_targetthrottle = 1.2
  1180. else
  1181. heli_targetthrottle = 0.7
  1182. end
  1183. if not pack_open then
  1184. heli_targetthrottle = 0
  1185. end
  1186. local t = CFrame.new()
  1187. if keys[ string.byte'a' ] then
  1188. t = t * CFrame.Angles( 0, 0, math.rad(10) )
  1189. end
  1190. if keys[ string.byte'd' ] then
  1191. t = t * CFrame.Angles( 0, 0, math.rad(-10) )
  1192. end
  1193. if keys[ string.byte'w' ] then
  1194. t = t * CFrame.Angles( math.rad(-10), 0, 0 )
  1195. end
  1196. if keys[ string.byte's' ] then
  1197. t = t * CFrame.Angles( math.rad(10), 0, 0 )
  1198. end
  1199. tilt = t
  1200. if framekeys[32] == true then
  1201. if tick() - lastSpaceTick < 0.3 then
  1202. lastSpaceTick = 0
  1203. if pack_open then closePack() else openPack() end
  1204. else
  1205. lastSpaceTick = tick()
  1206. end
  1207. end
  1208. end
  1209.  
  1210. openPack = function()
  1211. pack_open = true
  1212. heli_throttle = 0.6
  1213. heli_sound:Stop()
  1214. heli_sound:Play()
  1215. humanoid.PlatformStand = true
  1216. bodygyro.Parent = heli_top
  1217. fake_l_arm.CanCollide = true
  1218. fake_r_arm.CanCollide = true
  1219. fake_l_leg.CanCollide = true
  1220. fake_r_leg.CanCollide = true
  1221. game:service("ControllerService"):ClearAllChildren()
  1222. end
  1223. closePack = function()
  1224. pack_open = false
  1225. humanoid.PlatformStand = false
  1226. bodygyro.Parent = nil
  1227. fake_l_arm.CanCollide = false
  1228. fake_r_arm.CanCollide = false
  1229. fake_l_leg.CanCollide = false
  1230. fake_r_leg.CanCollide = false
  1231.  
  1232. coroutine.resume(coroutine.create(function()
  1233. wait(0.2)
  1234. Instance.new("HumanoidController",game:service("ControllerService"))
  1235. end))
  1236. end
  1237.  
  1238. getMass = function( p )
  1239. local mass = 0
  1240. if p:IsA("BasePart") then
  1241. mass = mass + p:GetMass()
  1242. end
  1243. for _, child in pairs( p:children() ) do
  1244. mass = mass + getMass( child )
  1245. end
  1246. return mass
  1247. end
  1248.  
  1249. updateMass = function()
  1250. bodymass = getMass( character )
  1251. end
  1252.  
  1253. collision_time = 0
  1254.  
  1255. onCollision = function( hit )
  1256. if collision_time <= 0 then
  1257. local hit_speed = ( torso.Velocity - hit.Velocity ).magnitude
  1258. if hit_speed > 65 and hit.CanCollide == true then
  1259. collision_time = 0.8
  1260. bodygyro.Parent = nil
  1261. end
  1262. end
  1263. end
  1264.  
  1265. torso.Touched:connect( onCollision )
  1266. head.Touched:connect( onCollision )
  1267.  
  1268. for _, child in pairs( character:children() ) do
  1269. if child.Name == "HeliPack" then
  1270. child:Destroy()
  1271. end
  1272. end
  1273.  
  1274. heli_model = create{ "Model", Name = "HeliPack", Parent = character }
  1275. script.Parent = heli_model
  1276.  
  1277. fake_l_arm = create { "Part", Parent = heli_model, FormFactor = "Custom", Size = Vector3.new(1,2,1), CanCollide = true, Transparency = 1, Elasticity = 0.1, Friction = 0.8 }
  1278. fake_r_arm = create { "Part", Parent = heli_model, FormFactor = "Custom", Size = Vector3.new(1,2,1), CanCollide = true, Transparency = 1, Elasticity = 0.1, Friction = 0.8 }
  1279. fake_l_leg = create { "Part", Parent = heli_model, FormFactor = "Custom", Size = Vector3.new(1,2,1), CanCollide = true, Transparency = 1, Elasticity = 0.1, Friction = 0.8 }
  1280. fake_r_leg = create { "Part", Parent = heli_model, FormFactor = "Custom", Size = Vector3.new(1,2,1), CanCollide = true, Transparency = 1, Elasticity = 0.1, Friction = 0.8 }
  1281. create{ "Weld", Part0 = l_arm, Part1 = fake_l_arm, Parent = character }
  1282. create{ "Weld", Part0 = r_arm, Part1 = fake_r_arm, Parent = character }
  1283. create{ "Weld", Part0 = l_leg, Part1 = fake_l_leg, Parent = character }
  1284. create{ "Weld", Part0 = r_leg, Part1 = fake_r_leg, Parent = character }
  1285.  
  1286. fake_l_arm.Touched:connect( onCollision )
  1287. fake_r_arm.Touched:connect( onCollision )
  1288. fake_l_leg.Touched:connect( onCollision )
  1289. fake_r_leg.Touched:connect( onCollision )
  1290.  
  1291. heli_base = create{ "Part", TopSurface = 0, BottomSurface = 0, FormFactor = "Custom", Parent = heli_model,
  1292. Size = Vector3.new(1.8, 1.8, 0.2), BrickColor = BrickColor.new(1002)
  1293. }
  1294. heli_motor = create{ "Part", TopSurface = 0, BottomSurface = 0, FormFactor = "Custom", Parent = heli_model,
  1295. Size = Vector3.new(1.8, 1.7, 0.6), BrickColor = BrickColor.new(194)
  1296. }
  1297. heli_axel = create{ "Part", TopSurface = 0, BottomSurface = 0, FormFactor = "Custom", Parent = heli_model, CanCollide = false,
  1298. Size = Vector3.new(0.2, 3.1, 0.2), BrickColor = BrickColor.new(1002)
  1299. }
  1300. local _hp = create{ "Part", Parent = heli_model, TopSurface = 0, BottomSurface = 0, FormFactor = "Custom", CanCollide = false, Size = Vector3.new(0.4, 0.2, 0.4), BrickColor = BrickColor.new("Black") }
  1301. create{ "CylinderMesh", Parent = _hp}
  1302. create{"Weld", Parent = heli_model, Part0 = heli_motor, Part1 = _hp, C0 = CFrame.new(0, 0.9, 0) }
  1303. heli_axeltop = create{ "Part", TopSurface = 0, BottomSurface = 0, FormFactor = "Custom", Parent = heli_model, CanCollide = false,
  1304. Size = Vector3.new(0.4, 0.2, 0.4), BrickColor = BrickColor.new("Black")
  1305. }
  1306. heli_top = create{ "Part", TopSurface = 0, BottomSurface = 0, FormFactor = "Custom", Parent = heli_model, CanCollide = false,
  1307. Size = Vector3.new(0.2, 0.2, 0.2), Transparency = 1
  1308. }
  1309. create{ "Weld", Part0 = heli_axel, Part1 = heli_top, C0 = CFrame.new(0,1.5,0), Parent = heli_model }
  1310.  
  1311. create{ "CylinderMesh", Parent = heli_axeltop }
  1312. create{ "CylinderMesh", Parent = heli_axel }
  1313.  
  1314. heli_rotor_weld = create{ "Weld", Parent = heli_model, Part0 = heli_axel, Part1 = heli_axeltop, C0 = CFrame.new(0,1.6,0) }
  1315.  
  1316. clone_rotor = create{ "Part", TopSurface = 0, BottomSurface = 0, FormFactor = "Custom", CanCollide = false,
  1317. Size = Vector3.new(1.1, 0.2, 4.5), Transparency = 1
  1318. }
  1319. create { "Decal", Parent = clone_rotor, Texture = "rbxassetid://142889819", Face = "Top" }
  1320. create { "Decal", Parent = clone_rotor, Texture = "rbxassetid://142889819", Face = "Bottom" }
  1321.  
  1322. for angle = 0, 360-120, 120 do
  1323. local part = clone_rotor:clone()
  1324. create{ "BlockMesh", Parent = part, Scale = Vector3.new(1,0,1) }
  1325. create{ "Weld", Part0 = heli_axeltop, Part1 = part, C0 = CFrame.Angles(0, math.rad(angle), 0), C1 = CFrame.new( 0, 0, -2.25 ), Parent = heli_model }
  1326. part.Parent = heli_model
  1327. end
  1328.  
  1329. create{ "Weld", Part0 = torso, Part1 = heli_base, C0 = CFrame.new( 0, 0, 0.6 ), Parent = heli_model }
  1330. create{ "Weld", Part0 = heli_base, Part1 = heli_motor, C0 = CFrame.new( 0, -0.05, 0.4 ), Parent = heli_model }
  1331.  
  1332. heli_axis_weld = create{ "Weld", Part0 = heli_motor, Part1 = heli_axel, C0 = CFrame.new( 0, 2.3, 0 ), Parent = heli_model }
  1333.  
  1334. heli_l_part = create{ "Part", TopSurface = 0, BottomSurface = 0, FormFactor = "Custom", Parent = heli_model, CanCollide = false, Size = Vector3.new(0.2, 1, 0.2), BrickColor = BrickColor.new(1002) }
  1335. heli_r_part = create{ "Part", TopSurface = 0, BottomSurface = 0, FormFactor = "Custom", Parent = heli_model, CanCollide = false, Size = Vector3.new(0.2, 1, 0.2), BrickColor = BrickColor.new(1002) }
  1336. heli_l_axel = create{ "Part", TopSurface = 0, BottomSurface = 0, FormFactor = "Custom", Parent = heli_model, CanCollide = false, Size = Vector3.new(0.2, 0.7, 0.2), BrickColor = BrickColor.new(1002) }
  1337. heli_r_axel = create{ "Part", TopSurface = 0, BottomSurface = 0, FormFactor = "Custom", Parent = heli_model, CanCollide = false, Size = Vector3.new(0.2, 0.7, 0.2), BrickColor = BrickColor.new(1002) }
  1338. heli_l_top = create{ "Part", TopSurface = 0, BottomSurface = 0, FormFactor = "Custom", Parent = heli_model, CanCollide = false, Size = Vector3.new(0.3, 0.2, 0.3), BrickColor = BrickColor.new("Black") }
  1339. heli_r_top = create{ "Part", TopSurface = 0, BottomSurface = 0, FormFactor = "Custom", Parent = heli_model, CanCollide = false, Size = Vector3.new(0.3, 0.2, 0.3), BrickColor = BrickColor.new("Black") }
  1340. create{"CylinderMesh", Parent = heli_l_top, Scale = Vector3.new(1,0.4,1) }
  1341. create{"CylinderMesh", Parent = heli_r_top, Scale = Vector3.new(1,0.4,1) }
  1342. create{"CylinderMesh", Parent = heli_l_part }
  1343. create{"CylinderMesh", Parent = heli_r_part }
  1344. create{"CylinderMesh", Parent = heli_l_axel, Scale = Vector3.new(0.8,1,0.8) }
  1345. create{"CylinderMesh", Parent = heli_r_axel, Scale = Vector3.new(0.8,1,0.8) }
  1346.  
  1347. create{ "Weld", Part0 = heli_motor, Part1 = heli_l_part, C0 = CFrame.new( -0.9, 0.65, 0 ) * CFrame.Angles(0,math.pi/2,0) * CFrame.Angles(-math.pi/2,0,0), C1 = CFrame.new(0, -0.5, 0), Parent = heli_model }
  1348. create{ "Weld", Part0 = heli_motor, Part1 = heli_r_part, C0 = CFrame.new( 0.9, 0.65, 0 ) * CFrame.Angles(0,-math.pi/2,0) * CFrame.Angles(-math.pi/2,0,0), C1 = CFrame.new(0, -0.5, 0), Parent = heli_model }
  1349. create{ "Weld", Part0 = heli_l_part, Part1 = heli_l_axel, C0 = CFrame.new( 0, 0.38, 0 ) * CFrame.Angles(0, 0, 1.4), C1 = CFrame.new(0, -0.3, 0), Parent = heli_model }
  1350. create{ "Weld", Part0 = heli_r_part, Part1 = heli_r_axel, C0 = CFrame.new( 0, 0.38, 0 ) * CFrame.Angles(0, 0, -1.4), C1 = CFrame.new(0, -0.3, 0), Parent = heli_model }
  1351.  
  1352. heli_l_weld = create{ "Weld", Part0 = heli_l_axel, Part1 = heli_l_top, C0 = CFrame.new( 0, 0.4, 0 ), Parent = heli_model }
  1353. heli_r_weld = create{ "Weld", Part0 = heli_r_axel, Part1 = heli_r_top, C0 = CFrame.new( 0, 0.4, 0 ), Parent = heli_model }
  1354.  
  1355. for angle = 0, 360-90, 90 do
  1356. local part = clone_rotor:clone()
  1357. part.Size = Vector3.new(0.6,0.2,1.6)
  1358. create{ "BlockMesh", Parent = part, Scale = Vector3.new(1,0,1) }
  1359. create{ "Weld", Part0 = heli_l_top, Part1 = part, C0 = CFrame.Angles(0, math.rad(angle), 0), C1 = CFrame.new( 0, 0, -0.8 ), Parent = heli_model }
  1360. part.Parent = heli_model
  1361. local part2 = clone_rotor:clone()
  1362. part2.Size = Vector3.new(0.6,0.2,1.6)
  1363. create{ "BlockMesh", Parent = part2, Scale = Vector3.new(1,0,1) }
  1364. create{ "Weld", Part0 = heli_r_top, Part1 = part2, C0 = CFrame.Angles(0, math.rad(angle), 0), C1 = CFrame.new( 0, 0, -0.8 ), Parent = heli_model }
  1365. part2.Parent = heli_model
  1366. end
  1367.  
  1368. heli_sound.Parent = heli_axeltop
  1369. bodyforce = create{ "BodyForce", force = Vector3.new(), Parent = heli_top }
  1370. bodygyro = create{ "BodyGyro", maxTorque = Vector3.new( 3000, 3000, 3000 ), P = 65, D = 7 }
  1371.  
  1372.  
  1373. heli_rotorspeed = 0
  1374. heli_rotorrot = 0
  1375. heli_throttle = 0
  1376. heli_targetthrottle = 0
  1377.  
  1378. heli_sound:Play()
  1379.  
  1380. updateMass()
  1381. closePack()
  1382.  
  1383. character.DescendantAdded:connect( updateMass )
  1384. character.DescendantRemoving:connect( updateMass )
  1385.  
  1386. local prevTime = tick()
  1387.  
  1388. local a = 0
  1389.  
  1390. loop = function()
  1391. local currTime = tick()
  1392. local delta = currTime - prevTime
  1393. prevTime = currTime
  1394.  
  1395. handleInput()
  1396.  
  1397. if collision_time > 0 then
  1398. collision_time = collision_time - delta
  1399. else
  1400. if pack_open and bodygyro.Parent ~= heli_top then
  1401. bodygyro.Parent = heli_top
  1402. end
  1403. end
  1404.  
  1405. heli_throttle = heli_throttle + (heli_targetthrottle - heli_throttle)*(0.06*delta*60.0)
  1406. heli_rotorspeed = heli_throttle*3200
  1407. heli_sound.Pitch = 1.9 + ( heli_throttle - 1 )*1
  1408.  
  1409. if heli_throttle > 0.002 then
  1410. if heli_sound.IsPaused then
  1411. heli_sound:Play()
  1412. end
  1413. heli_sound.Volume = 0.28*(heli_throttle-0.002)
  1414. else
  1415. if heli_sound.IsPlaying then
  1416. heli_sound:Pause()
  1417. end
  1418. end
  1419.  
  1420. heli_rotorrot = heli_rotorrot + heli_rotorspeed*delta
  1421. if heli_rotorrot > 180 then heli_rotorrot = heli_rotorrot - 360 elseif heli_rotorrot < -180 then heli_rotorrot = heli_rotorrot + 360 end
  1422. heli_rotor_weld.C0 = CFrame.new(0, 1.6, 0) * CFrame.Angles( 0, math.rad(-heli_rotorrot), 0 )
  1423. heli_l_weld.C1 = CFrame.Angles( 0, math.rad(heli_rotorrot), 0 )
  1424. heli_r_weld.C1 = CFrame.Angles( 0, math.rad(heli_rotorrot), 0 )
  1425.  
  1426. local cf = camera.CoordinateFrame * CFrame.Angles( math.rad(15), 0, 0 ) * tilt
  1427. bodygyro.cframe = cf
  1428. local up = ( torso.CFrame * CFrame.Angles( math.pi/2, 0, 0 )).lookVector
  1429.  
  1430. local acc = Vector3.new(1,1,1)*196.2*heli_throttle
  1431. bodyforce.force = up * acc * bodymass
  1432.  
  1433. local hit, hitpos = workspace:FindPartOnRay( Ray.new( torso.CFrame.p, -up*3.1 ), character )
  1434.  
  1435. if hit and pack_open and up.y > 0.88 and bodygyro.Parent == heli_top then
  1436. if hit.CanCollide then
  1437. closePack()
  1438. end
  1439. end
  1440.  
  1441. for i, _ in pairs( framekeys ) do
  1442. framekeys[i] = false
  1443. end
  1444. end
  1445.  
  1446. oc = oc or function(f) return f end
  1447.  
  1448. game:service("RunService").RenderStepped:connect( oc(loop) )
  1449. end)
  1450. shape = Instance.new("TextButton", Screen)
  1451. shape.Position = UDim2.new(0, 0, 0, 450)
  1452. shape.Size = UDim2.new(0, 100, 0, 50)
  1453. shape.Text = "Gui shapes"
  1454. shape.MouseButton1Down:connect(function()
  1455. wait()
  1456. local player;
  1457. local mouse;
  1458. local worldcamera;
  1459.  
  1460. local camera;
  1461. local world;
  1462. local screen;
  1463. local sg;
  1464.  
  1465.  
  1466. --[[
  1467. thanks for stealing this
  1468.  
  1469. obtw xsoul made dis
  1470. --]]
  1471.  
  1472.  
  1473. player = game.Players.LocalPlayer
  1474. mouse = player:GetMouse()
  1475.  
  1476. worldcamera = workspace.CurrentCamera
  1477.  
  1478. sg = Instance.new("ScreenGui", game.Players.LocalPlayer:WaitForChild("PlayerGui"))
  1479. screen = Instance.new("Frame", sg)
  1480. screen.BackgroundColor3 = Color3.new(1,1,1)
  1481. screen.Size = UDim2.new(1,0,1,20)
  1482. screen.BorderSizePixel = 0
  1483.  
  1484. create = function( tab )
  1485. local obj = Instance.new( tab[1] )
  1486. for i, v in pairs( tab ) do
  1487. if i ~= 1 then
  1488. obj[i] = v
  1489. end
  1490. end
  1491. return obj
  1492. end
  1493.  
  1494. local _hopper = create{"HopperBin", Parent = player.Backpack, Name = "HIDE MOUSE"}
  1495. _hopper.Selected:connect(function(moose)
  1496. moose.Icon = "rbxassetid://18662154"
  1497. _hopper:Destroy()
  1498. end)
  1499.  
  1500. local controllerservice;
  1501. repeat wait() controllerservice = game:service("ControllerService") until controllerservice
  1502. controllerservice:ClearAllChildren()
  1503.  
  1504.  
  1505. Display = {}
  1506.  
  1507. Display.resolution = screen.AbsoluteSize
  1508. Display.center = screen.AbsoluteSize/2
  1509. Display.update = function( self )
  1510. local s = screen.AbsoluteSize
  1511. self.resolution = s
  1512. self.center = s/2
  1513. self.x = s.x
  1514. self.y = s.y
  1515. end
  1516.  
  1517. Camera = {}
  1518.  
  1519. Camera.create = function( fov, near_clip, far_clip )
  1520. local self = setmetatable( {}, { __index = Camera } )
  1521. self.field_of_view = fov
  1522. self.near_clip = near_clip
  1523. self.far_clip = far_clip
  1524. self.fovMult = 1 / math.tan(math.rad(fov)/2)
  1525. self.cframe = CFrame.new()
  1526.  
  1527. return self
  1528. end
  1529.  
  1530. Camera.toScreenSpace = function( self, pos )
  1531. local dif = self.cframe:pointToObjectSpace(pos)
  1532. return
  1533. Display.x/2 + ( dif.x/-dif.z * self.fovMult * Display.y/Display.x ) * Display.x / 2,
  1534. Display.y/2 + ( dif.y/-dif.z * self.fovMult ) * Display.y / 2,
  1535. -dif.z
  1536. end
  1537.  
  1538. Camera.setFov = function( self, fov )
  1539. self.field_of_view = fov
  1540. end
  1541.  
  1542. Camera.applyRotation = function( self, rotation )
  1543. local pos = self.cframe.p
  1544. local rot = CFrame.Angles( 0, rotation.y, 0 )
  1545. rot = rot * CFrame.Angles( rotation.x, 0, 0 )
  1546. self.cframe = CFrame.new(pos) * rot
  1547. end
  1548.  
  1549. Camera.rotate = function( self, pitch, yaw, roll )
  1550. self.cframe = self.cframe * CFrame.Angles( math.rad( pitch ), math.rad( yaw ), math.rad( roll ) )
  1551. end
  1552. Camera.moveX = function( self, amnt )
  1553. self.cframe = self.cframe * CFrame.new( amnt, 0, 0 )
  1554. end
  1555. Camera.moveY = function( self, amnt )
  1556. self.cframe = self.cframe * CFrame.new( 0, amnt, 0 )
  1557. end
  1558. Camera.moveZ = function( self, amnt )
  1559. self.cframe = self.cframe * CFrame.new( 0, 0, amnt )
  1560. end
  1561.  
  1562.  
  1563. Point = {}
  1564. Point.mt = { __index = Point }
  1565.  
  1566. Point.new = function( pos )
  1567. local self = setmetatable( {}, Point.mt )
  1568. self.position = pos
  1569. return self
  1570. end
  1571.  
  1572. Connector = {}
  1573. Connector.mt = { __index = Connector }
  1574.  
  1575. Connector.new = function( point1, point2 )
  1576. local self = setmetatable( {}, Connector.mt )
  1577. self.point1 = point1
  1578. self.point2 = point2
  1579. self.gui = create{ "Frame", Parent = screen, BorderSizePixel = 1, BackgroundColor3 = Color3.new(), Position = UDim2.new(1, 50, 1, 50) }
  1580. return self
  1581. end
  1582.  
  1583. Connector.render = function( self, cframe )
  1584. local x1, y1, z1 = camera:toScreenSpace( cframe:pointToWorldSpace(self.point1.position) )
  1585. local x2, y2, z2 = camera:toScreenSpace( cframe:pointToWorldSpace(self.point2.position) )
  1586. local z = math.min(z1, z2)
  1587. local zz = math.max(z1, z2)
  1588.  
  1589. if z > 0 and (x1 > 0 or x2 > 0) and (x1 < Display.x or x2 < Display.x) and (y1 > 0 or y2 > 0) and (y1 < Display.y or y2 < Display.y) and zz/65 < 1 then
  1590. if self.gui.Parent ~= screen then
  1591. self.gui.Parent = screen
  1592. self.gui.Visible = true
  1593. end
  1594.  
  1595. local x, y = (x1+x2)/2, (y1+y2)/2
  1596. local dist = math.sqrt( (x2-x1)^2 + (y2-y1)^2 )
  1597. local h = 1
  1598.  
  1599. local alpha = zz/65
  1600. local alpha2 = zz/55
  1601. if alpha2 > 1 then alpha2 = 1 end
  1602.  
  1603. self.gui.BorderColor3 = Color3.new(alpha2, alpha2, alpha2)
  1604. self.gui.BackgroundColor3 = Color3.new(alpha, alpha, alpha)
  1605. self.gui.Position = UDim2.new(0, x-dist/2, 0, y-h/2)
  1606. self.gui.Size = UDim2.new(0, dist, 0, h)
  1607. self.gui.Rotation = math.deg( math.atan2( y2-y1, x2-x1 ) )
  1608. else
  1609. if self.gui.Parent ~= nil then
  1610. self.gui.Parent = nil
  1611. self.gui.Visible = false
  1612. end
  1613. end
  1614. end
  1615.  
  1616. Shape = {}
  1617. Shape.mt = { __index = Shape }
  1618.  
  1619. Shape.new = function( cframe )
  1620. local self = setmetatable( {}, Shape.mt )
  1621. self.points = {}
  1622. self.connectors = {}
  1623. self.cframe = cframe
  1624.  
  1625. return self
  1626. end
  1627.  
  1628. Shape.render = function( self )
  1629. self.cframe = self.cframe * CFrame.Angles(0.001211, 0.002654, -0.00125)
  1630. for _, connector in pairs( self.connectors ) do
  1631. connector:render(self.cframe)
  1632. end
  1633. end
  1634.  
  1635. Shape.cuboid = function(cframe, width, height, depth)
  1636. local self = Shape.new(cframe)
  1637.  
  1638. local function p(x,y,z)
  1639. local point = Point.new( Vector3.new(x*width/2,y*height/2,z*depth/2) )
  1640. table.insert(self.points, point)
  1641. return point
  1642. end
  1643.  
  1644. local function c(p1, p2)
  1645. local connector = Connector.new(p1,p2)
  1646. table.insert(self.connectors, connector)
  1647. return connector
  1648. end
  1649.  
  1650. local top_left_back = p(-1,1,1)
  1651. local top_right_back = p(1,1,1)
  1652. local bottom_left_back = p(-1,-1,1)
  1653. local bottom_right_back = p(1,-1,1)
  1654.  
  1655. local top_left_front = p(-1,1,-1)
  1656. local top_right_front = p(1,1,-1)
  1657. local bottom_left_front = p(-1,-1,-1)
  1658. local bottom_right_front = p(1,-1,-1)
  1659.  
  1660. c( top_left_back, top_right_back ) --back side
  1661. c( top_left_back, bottom_left_back )
  1662. c( bottom_right_back, top_right_back )
  1663. c( bottom_right_back, bottom_left_back )
  1664.  
  1665. c( top_left_front, top_right_front ) --front side
  1666. c( top_left_front, bottom_left_front )
  1667. c( bottom_right_front, top_right_front )
  1668. c( bottom_right_front, bottom_left_front )
  1669.  
  1670. c( top_left_front, top_left_back ) --edges
  1671. c( top_right_front, top_right_back )
  1672. c( bottom_left_front, bottom_left_back )
  1673. c( bottom_right_front, bottom_right_back )
  1674.  
  1675. return self
  1676. end
  1677.  
  1678. Shape.pyramid = function(cframe, size)
  1679. local self = Shape.new(cframe)
  1680.  
  1681. local function p(x,y,z)
  1682. local point = Point.new( Vector3.new(x*size/2,y*size/2,z*size/2) )
  1683. table.insert(self.points, point)
  1684. return point
  1685. end
  1686.  
  1687. local function c(p1, p2)
  1688. local connector = Connector.new(p1,p2)
  1689. table.insert(self.connectors, connector)
  1690. return connector
  1691. end
  1692.  
  1693. local top = p(0,1,0)
  1694. local left_back = p(-1,-1,-1)
  1695. local right_back = p(1,-1,-1)
  1696. local left_front = p(-1,-1,1)
  1697. local right_front = p(1,-1,1)
  1698.  
  1699. c(left_back, right_back)
  1700. c(left_back, left_front)
  1701. c(right_front, right_back)
  1702. c(right_front, left_front)
  1703.  
  1704. c(top, left_back)
  1705. c(top, right_back)
  1706. c(top, left_front)
  1707. c(top, right_front)
  1708.  
  1709. return self
  1710. end
  1711.  
  1712. Input = {}
  1713.  
  1714. Input.keys = {}
  1715.  
  1716. Input.isKeyDown = function(key)
  1717. return Input.keys[string.byte(key)] or false
  1718. end
  1719.  
  1720. mouse.KeyDown:connect(function(k)
  1721. Input.keys[string.byte(k)] = true
  1722. end)
  1723. mouse.KeyUp:connect(function(k)
  1724. Input.keys[string.byte(k)] = false
  1725. end)
  1726.  
  1727. local rotashun = Vector3.new()
  1728.  
  1729. camera = Camera.create( 80 )
  1730. camera.cframe = CFrame.new(Vector3.new(0,0,22), Vector3.new(0,0,0))
  1731.  
  1732. world = {}
  1733. world.shapes = {}
  1734. world.render = function(self)
  1735. for _, shape in pairs(self.shapes) do
  1736. shape:render()
  1737. end
  1738. end
  1739.  
  1740. local function _r(a)
  1741. return (math.random()-0.5)*2*a
  1742. end
  1743.  
  1744. for i = 1, 9 do
  1745. table.insert(world.shapes, Shape.cuboid( CFrame.new(_r(14), _r(14), _r(14)) * CFrame.Angles(_r(math.pi), _r(math.pi), _r(math.pi)), _r(1.5)+1.8, _r(1.5)+1.8,_r(1.5)+1.8 ))
  1746. end
  1747. for i = 1, 9 do
  1748. table.insert(world.shapes, Shape.pyramid( CFrame.new(_r(14), _r(14), _r(14)) * CFrame.Angles(_r(math.pi), _r(math.pi), _r(math.pi)), _r(1.5)+1.8 ))
  1749. end
  1750. for i = 1, 9 do
  1751. table.insert(world.shapes, Shape.cuboid( CFrame.new(_r(70), _r(70), _r(70)) * CFrame.Angles(_r(math.pi), _r(math.pi), _r(math.pi)), _r(1.5)+1.8, _r(1.5)+1.8,_r(1.5)+1.8 ))
  1752. end
  1753. for i = 1, 9 do
  1754. table.insert(world.shapes, Shape.pyramid( CFrame.new(_r(70), _r(70), _r(70)) * CFrame.Angles(_r(math.pi), _r(math.pi), _r(math.pi)), _r(1.5)+1.8 ))
  1755. end
  1756.  
  1757. local prevTime = tick()
  1758.  
  1759. render = function()
  1760. world:render()
  1761. end
  1762.  
  1763. local roro = rotashun
  1764.  
  1765. loop = function()
  1766. local currentTime = tick()
  1767. local delta = currentTime - prevTime
  1768. prevTime = currentTime
  1769.  
  1770. Display:update()
  1771.  
  1772. local mousedelta = mouseupdate()
  1773.  
  1774. rotashun = rotashun + Vector3.new( mousedelta.y*0.15, -mousedelta.x*0.15, 0 )
  1775. if rotashun.x > 87 then rotashun = Vector3.new(87, rotashun.y, rotashun.z) end
  1776. if rotashun.x < -87 then rotashun = Vector3.new(-87, rotashun.y, rotashun.z) end
  1777. if rotashun.y > 180 then rotashun = Vector3.new(rotashun.x, rotashun.y-360, rotashun.z) end
  1778. if rotashun.y < -180 then rotashun = Vector3.new(rotashun.x, rotashun.y+360, rotashun.z) end
  1779.  
  1780. local diff = (rotashun - roro)
  1781. if math.abs(diff.y) > 180 then
  1782. diff = Vector3.new(diff.x, diff.y-(diff.y/math.abs(diff.y))*360, diff.z)
  1783. end
  1784. roro = (roro + diff*0.35)
  1785. roro = Vector3.new(roro.x, roro.y%360, roro.z)
  1786.  
  1787. camera:applyRotation( roro/(180/math.pi) )
  1788.  
  1789. if Input.isKeyDown'w' then
  1790. camera:moveZ( -0.2 )
  1791. end
  1792. if Input.isKeyDown's' then
  1793. camera:moveZ( 0.2 )
  1794. end
  1795. if Input.isKeyDown'a' then
  1796. camera:moveX( -0.2 )
  1797. end
  1798. if Input.isKeyDown'd' then
  1799. camera:moveX( 0.2 )
  1800. end
  1801.  
  1802. render()
  1803. end
  1804.  
  1805. mousePos = Vector2.new(mouse.X, mouse.Y)
  1806. lastMousePos = mousePos
  1807.  
  1808. local ticks = -1
  1809.  
  1810. mouseupdate = function()
  1811. lastMousePos = mousePos
  1812. mousePos = Vector2.new(mouse.X, mouse.Y)
  1813. local mouseDelta = mousePos - lastMousePos
  1814.  
  1815. if (mousePos-Display.center).magnitude > 225 then
  1816. player.CameraMode = Enum.CameraMode.LockFirstPerson
  1817. worldcamera.CameraType = "Custom"
  1818. worldcamera.CameraSubject = humanoid
  1819.  
  1820. ticks = 2
  1821. end
  1822.  
  1823. if ticks > 0 then
  1824. ticks = ticks - 1
  1825. end
  1826.  
  1827. if ticks == 0 then
  1828. ticks = -1
  1829. player.CameraMode = Enum.CameraMode.Classic
  1830. worldcamera.CameraType = "Scriptable"
  1831. end
  1832.  
  1833. if mouseDelta.magnitude > 200 then
  1834. mouseDelta = Vector2.new()
  1835. end
  1836.  
  1837. return mouseDelta
  1838. end
  1839.  
  1840. game:service("RunService").RenderStepped:connect(loop)
  1841. end)
Add Comment
Please, Sign In to add comment