Advertisement
Hmm465_Gaming

vrscript

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