TheUnknownDiscord

gravity control

Oct 22nd, 2021 (edited)
319
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local model = Instance.new("Model", script)
  2. model.Name = owner.Name
  3. hum = Instance.new("Humanoid", model)
  4. hum.MaxHealth = 0
  5. hum.Health = 0
  6. local block = Instance.new("Part", model)
  7. block.Size = Vector3.new(1.5,1.4,1.75)
  8. block.CFrame = owner.Character:FindFirstChildWhichIsA("BasePart").CFrame
  9. block.Color = Color3.fromRGB(math.random(0,255),math.random(0,255),math.random(0,255))
  10. block.Material = 'SmoothPlastic'
  11. block.Name = "Head"
  12. local nokill = Instance.new("RemoteEvent", block)
  13. nokill.Name = "The"
  14. block.Locked = true
  15. local block2 = Instance.new("Part", block)
  16. block2.Size = Vector3.new(1.5,0.1,1.75)
  17. block2.CFrame = owner.Character:FindFirstChildWhichIsA("BasePart").CFrame
  18. block2.Color = Color3.fromRGB(math.random(0,255),math.random(0,255),math.random(0,255))
  19. block2.Material = 'SmoothPlastic'
  20. ShootWeld = Instance.new("Weld", block)
  21. ShootWeld.Part0 = block2
  22. ShootWeld.Part1 = block
  23. ShootWeld.C0 = CFrame.new(0,0.75,0)
  24. local nokill2 = Instance.new("RemoteEvent", block2)
  25. block2.Locked = true
  26. local block3 = Instance.new("Part", block)
  27. block3.Size = Vector3.new(0.25,1.125,0.5)
  28. block3.CFrame = owner.Character:FindFirstChildWhichIsA("BasePart").CFrame
  29. block3.Color = Color3.fromHSV(0,0,0)
  30. block3.Material = 'SmoothPlastic'
  31. ShootWeld2 = Instance.new("Weld", block)
  32. ShootWeld2.Part0 = block3
  33. ShootWeld2.Part1 = block
  34. ShootWeld2.C0 = CFrame.new(0.5625,-0.0625,0.725)
  35. local nokill3 = Instance.new("RemoteEvent", block3)
  36. block3.Locked = true
  37. block3.CanCollide = false
  38. local block4 = Instance.new("Part", block)
  39. block4.Size = Vector3.new(0.25,1.125,0.5)
  40. block4.CFrame = owner.Character:FindFirstChildWhichIsA("BasePart").CFrame
  41. block4.Color = Color3.fromHSV(0,0,0)
  42. block4.Material = 'SmoothPlastic'
  43. ShootWeld3 = Instance.new("Weld", block)
  44. ShootWeld3.Part0 = block4
  45. ShootWeld3.Part1 = block
  46. ShootWeld3.C0 = CFrame.new(-0.5625,-0.0625,0.725)
  47. local nokill4 = Instance.new("RemoteEvent", block4)
  48. block4.Locked = true
  49. block4.CanCollide = false
  50. local block5 = Instance.new("Part", block)
  51. block5.Size = Vector3.new(1.5,1.4,0.5)
  52. block5.CFrame = owner.Character:FindFirstChildWhichIsA("BasePart").CFrame
  53. block5.Color = Color3.fromHSV(0,0,0)
  54. block5.Material = 'SmoothPlastic'
  55. ShootWeld4 = Instance.new("Weld", block)
  56. ShootWeld4.Part0 = block5
  57. ShootWeld4.Part1 = block
  58. ShootWeld4.C0 = CFrame.new(0.125,0,0.675) * CFrame.Angles(0,0,math.rad(-90))
  59. local nokill5 = Instance.new("RemoteEvent", block5)
  60. block5.Locked = true
  61. block5.CanCollide = false
  62. block5.Transparency = 1
  63. owner.Character.Parent = nil
  64. local object = Instance.new("ObjectValue", owner.PlayerGui)
  65. object.Value = block
  66. object.Name = 'BLOCK'
  67. local object2 = Instance.new("ObjectValue", owner.PlayerGui)
  68. object2.Value = model
  69. object2.Name = 'MODEL'
  70. local density = 0.0125
  71. local friction = 1
  72. local elasticity = 0
  73. local frictionWeight = 100000000000
  74. local elasticityWeight = 0
  75. local physProperties = PhysicalProperties.new(density, friction, elasticity, frictionWeight, elasticityWeight)
  76. block2.CustomPhysicalProperties = physProperties
  77. block3.CustomPhysicalProperties = physProperties
  78. block4.CustomPhysicalProperties = physProperties
  79. block5.CustomPhysicalProperties = physProperties
  80. block:SetNetworkOwner(owner)
  81. local screengui2 = Instance.new("SurfaceGui", block5)
  82. screengui2.Name = "Hud"
  83. screengui2.Face = Enum.NormalId.Front
  84. local tl = Instance.new("TextBox", screengui2)
  85. tl.Size = UDim2.new(1, 0, 1, 0)
  86. tl.Text = "3"
  87. tl.TextSize = 400
  88. tl.TextTransparency = 0
  89. tl.BackgroundTransparency = 1
  90. tl.Position = UDim2.new(0,0,0,0)
  91. NLS([[
  92. jump = false
  93. local Speed = 0
  94. local rotspeed = 0
  95. local rotspeed2 = 0
  96. local mouse = owner:GetMouse()
  97. local uis = game:GetService("UserInputService")
  98. local block = owner.PlayerGui.BLOCK.Value
  99. local model = owner.PlayerGui.MODEL.Value
  100. model.Name = ""
  101. local nokill = block:WaitForChild("The")
  102. currentcf = block.CFrame
  103.  
  104. uis.InputBegan:Connect(function(input)
  105. input = input.KeyCode
  106. if input == Enum.KeyCode.W then
  107. Speed = 1
  108.  
  109. elseif input == Enum.KeyCode.A then
  110. rotspeed = 1
  111. rotspeed2 = 0
  112. elseif input == Enum.KeyCode.S then
  113. Speed = -1
  114.  
  115. elseif input == Enum.KeyCode.D then
  116. rotspeed = -1
  117. rotspeed2 = 0
  118. elseif input == Enum.KeyCode.Space then
  119. jump = true
  120. wait(0.25)
  121. jump = false
  122. end
  123. end)
  124.  
  125. uis.InputEnded:Connect(function(input)
  126. input = input.KeyCode
  127. if input == Enum.KeyCode.W then
  128. Speed = 0
  129. elseif input == Enum.KeyCode.A then
  130. rotspeed = 0
  131. rotspeed2 = 1
  132. elseif input == Enum.KeyCode.S then
  133. Speed = 0
  134. elseif input == Enum.KeyCode.D then
  135. rotspeed = 0
  136. rotspeed2 = 1
  137. end
  138. end)
  139.  
  140. local xzGyro = Instance.new("BodyGyro")
  141. xzGyro.MaxTorque = Vector3.new(100000,0,100000)
  142. xzGyro.P = 100000
  143. xzGyro.D = 2500
  144. xzGyro.Parent = block
  145. local bf = Instance.new("BodyForce", block)
  146. pcall(function()
  147. game:GetService("RunService").RenderStepped:Connect(function()
  148. if jump then
  149. bf.Force = block.CFrame.upVector * block:GetMass() * 1 * workspace.Gravity * block:GetMass() * 1
  150. elseif not jump then
  151. bf.Force = block.CFrame.upVector * block:GetMass() * -1 * workspace.Gravity * block:GetMass() * 1
  152. end
  153. local params = RaycastParams.new()
  154. params.FilterDescendantsInstances = {block, owner.Character}
  155. params.FilterType = Enum.RaycastFilterType.Blacklist
  156. local result = workspace:Raycast(block.Position, block.CFrame.upVector * -1 + block.CFrame.lookVector * 1.75, params)
  157. local result2 = workspace:Raycast(block.Position, block.CFrame.upVector * 1 + block.CFrame.lookVector * 1.75, params)
  158. local result3 = workspace:Raycast(block.Position, block.CFrame.upVector * 1, params)
  159. local result4 = workspace:Raycast(block.Position, block.CFrame.upVector * -1 + block.CFrame.lookVector * -1.75, params)
  160. local result5 = workspace:Raycast(block.Position, block.CFrame.upVector * 1 + block.CFrame.lookVector * -1.75, params)
  161. local result6 = workspace:Raycast(block.Position, block.CFrame.upVector * -1, params)
  162.  
  163. if (result) then
  164. local currentRightVector = block.CFrame.RightVector
  165. local upVector = result.Normal
  166. local newFacialVector = currentRightVector:Cross(upVector)
  167. xzGyro.CFrame = CFrame.fromMatrix(block.Position, currentRightVector, upVector, newFacialVector)
  168. elseif (result2) then
  169. local currentRightVector = block.CFrame.RightVector
  170. local upVector = result2.Normal
  171. local newFacialVector = currentRightVector:Cross(upVector)
  172. xzGyro.CFrame = CFrame.fromMatrix(block.Position, currentRightVector, upVector, newFacialVector)
  173. elseif (result3) then
  174. local currentRightVector = block.CFrame.RightVector
  175. local upVector = result3.Normal
  176. local newFacialVector = currentRightVector:Cross(upVector)
  177. xzGyro.CFrame = CFrame.fromMatrix(block.Position, currentRightVector, upVector, newFacialVector)
  178. elseif (result4) then
  179. local currentRightVector = block.CFrame.RightVector
  180. local upVector = result4.Normal
  181. local newFacialVector = currentRightVector:Cross(upVector)
  182. xzGyro.CFrame = CFrame.fromMatrix(block.Position, currentRightVector, upVector, newFacialVector)
  183. elseif (result5) then
  184. local currentRightVector = block.CFrame.RightVector
  185. local upVector = result5.Normal
  186. local newFacialVector = currentRightVector:Cross(upVector)
  187. xzGyro.CFrame = CFrame.fromMatrix(block.Position, currentRightVector, upVector, newFacialVector)
  188. elseif (result6) then
  189. local currentRightVector = block.CFrame.RightVector
  190. local upVector = result6.Normal
  191. local newFacialVector = currentRightVector:Cross(upVector)
  192. xzGyro.CFrame = CFrame.fromMatrix(block.Position, currentRightVector, upVector, newFacialVector)
  193. end
  194.  
  195. end)
  196. end)
  197. game:GetService("RunService").RenderStepped:Connect(function()
  198. workspace.CurrentCamera.CFrame = block.CFrame * CFrame.new(0,4,6) * CFrame.Angles(math.rad(-15), 0, 0)
  199. block.Velocity = block.CFrame.LookVector * Speed * 30
  200. block.AssemblyAngularVelocity = block.CFrame.upVector * rotspeed * 5
  201. end)
  202. ]], owner.PlayerGui)
  203. local density = 1
  204. local friction = 1
  205. local elasticity = 0
  206. local frictionWeight = 100000000000
  207. local elasticityWeight = 0
  208. local physProperties = PhysicalProperties.new(density, friction, elasticity, frictionWeight, elasticityWeight)
  209. block.CustomPhysicalProperties = physProperties
  210. local tweenService = game:GetService("TweenService")
  211. local timeToFade = 0.5
  212. local object = block3
  213. local tweenInfo = TweenInfo.new(timeToFade)
  214. local goal = {}
  215. goal.Size = Vector3.new(0.25,0.125,0.5)
  216.  
  217. local tween = tweenService:Create(object, tweenInfo, goal)
  218. local object2 = block4
  219. local tween2 = tweenService:Create(object2, tweenInfo, goal)
  220. local timeToFade2 = 0.5
  221. local object3 = block3
  222. local tweenInfo2 = TweenInfo.new(timeToFade2)
  223. local goal2 = {}
  224. goal2.Size = Vector3.new(0.25,1.125,0.5)
  225.  
  226. local tween3 = tweenService:Create(object3, tweenInfo2, goal2)
  227. local object4 = block4
  228. local tween4 = tweenService:Create(object4, tweenInfo2, goal2)
  229. warn("Hows it hanging?")
  230. print("Made by Haker Man / Lucas_YT111")
  231. bodyparts = {}
  232.  
  233. function protectlimb(part,props,index)
  234. if not part then return end
  235. local index,props = index or #bodyparts+1,props or {Parent = part.Parent}
  236. bodyparts[index] = part
  237. part.Parent = props.Parent
  238. part.AncestryChanged:Connect(function(part,newparent)
  239. if newparent~=nil and not part:IsDescendantOf(props.Parent) then
  240. part.Parent = props.Parent
  241. elseif newparent == nil then
  242. local newp = part:Clone()
  243. protectlimb(newp,props,index)
  244. end
  245. end)
  246. return bodyparts[index]
  247. end
  248. table.foreach(script:GetDescendants(),function(i,v) if v:IsA("BasePart") then protectlimb(v) end end)
  249. while true do
  250. wait(3.25)
  251. tween:Play()
  252. tween2:Play()
  253. wait(0.5)
  254. tween3:Play()
  255. tween4:Play()
  256. end
RAW Paste Data