scriptingboi1

VR without a headset

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