Advertisement
dogepack

R6 no vr vr script

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