Dark_EccentricYT

Untitled

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