Advertisement
samuelrichter66

VR roblox

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