Dark_EccentricYT

Untitled

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