KengTheBoby

HElp

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