Advertisement
Sharkkkkkk

vr

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