Advertisement
robloxscriptsbbbbb

vr script

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