AnormalPerson

Untitled

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