Advertisement
Destroy666j

Untitled

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