vr script for roblox clovr - Pastebin.com (2024)

  1. https://pastebin.com/SbnExV2w

  2. -- | made by 0866!!!!!!! and abacaxl!!!!!!!!

  3. -- | tysm unverified

  4. -- | tutorial and info: https://docs.google.com/document/d/16gb1NGq-ajBO55EgPhFBVq1DrpMdpk2qVPMaCpWrI5c/edit?usp=sharing

  5. -- | should be functional for non-VR users, rightclick/leftclick = point right/left arm, may perform worse

  6. -- | things you can do:

  7. -- use tools and the likes (not functional with RagdollEnabled)

  8. -- move and interact with the luxury of a full body (no leg tracking, feet auto place)

  9. -- interact with things as a robloxian, accurate sizing and full body allows for full immersion

  10. -- play as your own roblox character by enabling RagdollEnabled (R6 only, RagdollHeadMovement adds an extra 10 seconds to script startup)

  11. -- move & teleport accurately by pointing your right hand and holding-releasing Y or B

  12. -- view nearby players chatting & view nearby characters including yourself in the bottom right, good for recording videos

  13. -- total customizability over what you appear as (Ragdoll disabled only)

  14. -- | this version will likely be patched by roblox soon, we will be rewriting it to be worth selling long after this release!

  15. --|| Controls:

  16. -- [ R2 ]- Sprint

  17. -- [ L2 ]- Crouch

  18. -- [ L2 TAP ]- Chat HUD

  19. -- [ Y ]- Point Walk-- movement joystick works -- may or may not be mixed up with the Teleport button

  20. -- [ B ]- Point Teleport-- may or may not be mixed up with the Walk button

  21. -- [ X ]- RagdollEnabled die

  22. -- [ C ]- Non-VR Teleport

  23. -- [ LSHIFT ]- Non-VR Sprint

  24. -- [ LCTRL ]- Non-VR Crouch

  25. -- Default Roblox VR controls are included

  26. --|| Settings:

  27. local StudsOffset = 0.1 -- Character height offset (make negative if you're too high)

  28. local Smoothness = 0.3 -- Character interpolation (0.1 - 1 = smooth - rigid)

  29. local AnchorCharacter = true -- Prevent physics from causing inconsistencies (Keep this on for accurate tool positioning)

  30. local HideCharacter = false -- Hide character on a faraway platform

  31. local NoCollision = true -- Disable collision with nearby players

  32. local ChatEnabled = true -- See chat on your left hand in-game (Toggle with the crouch button lol)

  33. local ChatLocalRange = 70 -- Local chat range

  34. local ViewportEnabled = true -- View yourself and nearby players in a frame

  35. local ViewportRange = 30 -- Maximum distance players are updated

  36. local RagdollEnabled = false -- Use your character instead of hats (NetworkOwner vulnerability)

  37. local RagdollHeadMovement = true -- Move your head separately from your body (+9 second wait)

  38. local AutoRun = false -- Rerun script on respawn

  39. local AutoRespawn = true -- Reset when your virtual body dies

  40. local WearAllAccessories = true -- Use all leftover hats for the head

  41. local AccurateHandPosition = false -- Position your Roblox hands according to your real hands

  42. local AccessorySettings = {

  43. LeftArm= "LavanderHair"; -- Name of hat used as this limb

  44. RightArm= "Pal Hair"; -- Name of hat used as this limb

  45. LeftLeg= "Kate Hair"; -- Name of hat used as this limb

  46. RightLeg= "Hat1"; -- Name of hat used as this limb

  47. Torso= "SeeMonkey"; -- Name of hat used as this limb

  48. Head= true; -- Are extra hats assumed to be worn?

  49. BlockArms= true; -- Remove accessory meshes of this limb

  50. BlockLegs= true; -- Remove accessory meshes of this limb

  51. BlockTorso= true; -- Remove accessory meshes of this limb

  52. LimbOffset= CFrame.Angles(math.rad(90), 0, 0); -- Don't touch

  53. }

  54. local FootPlacementSettings = {

  55. RightOffset = Vector3.new(.5, 0, 0),

  56. LeftOffset = Vector3.new(-.5, 0, 0),

  57. }

  58. --|| Script:

  59. local Script = nil;

  60. local Pointer = nil;

  61. -- My coding style changed throughout this a lot lol

  62. Script = function()

  63. --[[

  64. Variables

  65. --]]

  66. local Players = game:GetService("Players")

  67. local Client = Players.LocalPlayer

  68. local Character = Client.Character or Client.CharacterAdded:Wait()

  69. local WeldBase = Character:WaitForChild("HumanoidRootPart")

  70. local ArmBase = Character:FindFirstChild("RightHand") or Character:FindFirstChild("Right Arm") or WeldBase

  71. local Backpack = Client:WaitForChild("Backpack")

  72. local Mouse = Client:GetMouse()

  73. local Camera = workspace.CurrentCamera

  74. local VRService = game:GetService("VRService")

  75. local VRReady = VRService.VREnabled

  76. local UserInputService = game:GetService("UserInputService")

  77. local RunService = game:GetService("RunService")

  78. local HttpService = game:GetService("HttpService")

  79. local StarterGui = game:GetService("StarterGui")

  80. local HeadAccessories = {};

  81. local UsedAccessories = {};

  82. local Pointer = false;

  83. local Point1 = false;

  84. local Point2 = false;

  85. local VirtualRig = game:GetObjects("rbxassetid://4468539481")[1]

  86. local VirtualBody = game:GetObjects("rbxassetid://4464983829")[1]

  87. local Anchor = Instance.new("Part")

  88. Anchor.Anchored = true

  89. Anchor.Transparency = 1

  90. Anchor.CanCollide = false

  91. Anchor.Parent = workspace

  92. if RagdollEnabled then

  93. if script:FindFirstChild("Network") then

  94. Network = require(script.Network)

  95. else

  96. Network = loadstring(game:HttpGet("https://pastebin.com/raw/bJms9qqM", true))()

  97. end

  98. Network:Claim();

  99. end

  100. StarterGui:SetCore("VRLaserPointerMode", 3)

  101. --[[

  102. Character Protection

  103. --]]

  104. local CharacterCFrame = WeldBase.CFrame

  105. if not RagdollEnabled then

  106. Character.Humanoid.AnimationPlayed:Connect(function(Animation)

  107. Animation:Stop()

  108. end)

  109. for _, Track in next, Character.Humanoid:GetPlayingAnimationTracks() do

  110. Track:Stop()

  111. end

  112. wait(.5)

  113. if HideCharacter then

  114. local Platform = Instance.new("Part")

  115. Platform.Anchored = true

  116. Platform.Size = Vector3.new(100, 5, 100)

  117. Platform.CFrame = CFrame.new(0, 10000, 0)

  118. Platform.Transparency = 1

  119. Platform.Parent = workspace

  120. Character:MoveTo(Platform.Position + Vector3.new(0, 5, 0))

  121. wait(.5)

  122. end

  123. if AnchorCharacter then

  124. for _, Part in pairs(Character:GetChildren()) do

  125. if Part:IsA("BasePart") then

  126. Part.Anchored = true

  127. end

  128. end

  129. end

  130. end

  131. --[[

  132. Functions

  133. --]]

  134. function Tween(Object, Style, Direction, Time, Goal)

  135. local tweenInfo = TweenInfo.new(Time, Enum.EasingStyle[Style], Enum.EasingDirection[Direction])

  136. local tween = game:GetService("TweenService"):Create(Object, tweenInfo, Goal)

  137. tween.Completed:Connect(function()

  138. tween:Destroy()

  139. end)

  140. tween:Play()

  141. return tween

  142. end

  143. local function GetMotorForLimb(Limb)

  144. for _, Motor in next, Character:GetDescendants() do

  145. if Motor:IsA("Motor6D") and Motor.Part1 == Limb then

  146. return Motor

  147. end

  148. end

  149. end

  150. local function CreateAlignment(Limb, Part0)

  151. local Attachment0 = Instance.new("Attachment", Part0 or Anchor)

  152. local Attachment1 = Instance.new("Attachment", Limb)

  153. local Orientation = Instance.new("AlignOrientation")

  154. local Position = Instance.new("AlignPosition")

  155. Orientation.Attachment0 = Attachment1

  156. Orientation.Attachment1 = Attachment0

  157. Orientation.RigidityEnabled = false

  158. Orientation.MaxTorque = 20000

  159. Orientation.Responsiveness = 40

  160. Orientation.Parent = Character.HumanoidRootPart

  161. Position.Attachment0 = Attachment1

  162. Position.Attachment1 = Attachment0

  163. Position.RigidityEnabled = false

  164. Position.MaxForce = 40000

  165. Position.Responsiveness = 40

  166. Position.Parent = Character.HumanoidRootPart

  167. Limb.Massless = false

  168. local Motor = GetMotorForLimb(Limb)

  169. if Motor then

  170. Motor:Destroy()

  171. end

  172. return function(CF, Local)

  173. if Local then

  174. Attachment0.CFrame = CF

  175. else

  176. Attachment0.WorldCFrame = CF

  177. end

  178. end;

  179. end

  180. local function GetExtraTool()

  181. for _, Tool in next, Character:GetChildren() do

  182. if Tool:IsA("Tool") and not Tool.Name:match("LIMB_TOOL") then

  183. return Tool

  184. end

  185. end

  186. end

  187. local function GetGripForHandle(Handle)

  188. for _, Weld in next, Character:GetDescendants() do

  189. if Weld:IsA("Weld") and (Weld.Part0 == Handle or Weld.Part1 == Handle) then

  190. return Weld

  191. end

  192. end

  193. wait(.2)

  194. for _, Weld in next, Character:GetDescendants() do

  195. if Weld:IsA("Weld") and (Weld.Part0 == Handle or Weld.Part1 == Handle) then

  196. return Weld

  197. end

  198. end

  199. end

  200. local function CreateRightGrip(Handle)

  201. local RightGrip = Instance.new("Weld")

  202. RightGrip.Name = "RightGrip"

  203. RightGrip.Part1 = Handle

  204. RightGrip.Part0 = WeldBase

  205. RightGrip.Parent = WeldBase

  206. return RightGrip

  207. end

  208. local function CreateAccessory(Accessory, DeleteMeshes)

  209. if not Accessory then

  210. return

  211. end

  212. local HatAttachment = Accessory.Handle:FindFirstChildWhichIsA("Attachment")

  213. local HeadAttachment = VirtualRig:FindFirstChild(HatAttachment.Name, true)

  214. local BasePart = HeadAttachment.Parent

  215. local HatAtt = HatAttachment.CFrame

  216. local HeadAtt = HeadAttachment.CFrame

  217. if DeleteMeshes then

  218. if Accessory.Handle:FindFirstChild("Mesh") then

  219. Accessory.Handle.Mesh:Destroy()

  220. end

  221. end

  222. wait()

  223. local Handle = Accessory:WaitForChild("Handle")

  224. if Handle:FindFirstChildWhichIsA("Weld", true) then

  225. Handle:FindFirstChildWhichIsA("Weld", true):Destroy()

  226. Handle:BreakJoints()

  227. else

  228. Handle:BreakJoints()

  229. end

  230. Handle.Massless = true

  231. Handle.Transparency = 0.5

  232. UsedAccessories[Accessory] = true

  233. local RightGrip = CreateRightGrip(Handle)

  234. wait()

  235. for _, Object in pairs(Handle:GetDescendants()) do

  236. if not Object:IsA("BasePart") then

  237. pcall(function()

  238. Object.Transparency = 1

  239. end)

  240. pcall(function()

  241. Object.Enabled = false

  242. end)

  243. end

  244. end

  245. return Handle, RightGrip, HatAtt, HeadAtt, BasePart;

  246. end

  247. local function GetHeadAccessories()

  248. for _, Accessory in next, Character:GetChildren() do

  249. if Accessory:IsA("Accessory") and not UsedAccessories[Accessory] then

  250. local Handle, RightGrip, HatAtt, HeadAtt, BasePart = CreateAccessory(Accessory)

  251. table.insert(HeadAccessories, {Handle, RightGrip, HatAtt, HeadAtt, BasePart})

  252. do

  253. Handle.Transparency = 1

  254. end

  255. if not WearAllAccessories then

  256. break

  257. end

  258. end

  259. end

  260. end

  261. --[[

  262. VR Replication Setup

  263. --]]

  264. if not RagdollEnabled then

  265. LeftHandle, LeftHandGrip = CreateAccessory(Character:FindFirstChild(AccessorySettings.LeftArm), AccessorySettings.BlockArms)

  266. RightHandle, RightHandGrip = CreateAccessory(Character:FindFirstChild(AccessorySettings.RightArm), AccessorySettings.BlockArms)

  267. LeftHipHandle, LeftLegGrip = CreateAccessory(Character:FindFirstChild(AccessorySettings.LeftLeg), AccessorySettings.BlockLegs)

  268. RightHipHandle, RightLegGrip = CreateAccessory(Character:FindFirstChild(AccessorySettings.RightLeg), AccessorySettings.BlockLegs)

  269. TorsoHandle, TorsoGrip = CreateAccessory(Character:FindFirstChild(AccessorySettings.Torso), AccessorySettings.BlockTorso)

  270. GetHeadAccessories()

  271. elseif RagdollEnabled then

  272. if RagdollHeadMovement then

  273. Permadeath()

  274. MoveHead = CreateAlignment(Character["Head"])

  275. end

  276. MoveRightArm = CreateAlignment(Character["Right Arm"])

  277. MoveLeftArm = CreateAlignment(Character["Left Arm"])

  278. MoveRightLeg = CreateAlignment(Character["Right Leg"])

  279. MoveLeftLeg = CreateAlignment(Character["Left Leg"])

  280. MoveTorso = CreateAlignment(Character["Torso"])

  281. MoveRoot = CreateAlignment(Character.HumanoidRootPart)

  282. if RagdollHeadMovement then

  283. for _, Accessory in next, Character:GetChildren() do

  284. if Accessory:IsA("Accessory") and Accessory:FindFirstChild("Handle") then

  285. local Attachment1 = Accessory.Handle:FindFirstChildWhichIsA("Attachment")

  286. local Attachment0 = Character:FindFirstChild(tostring(Attachment1), true)

  287. local Orientation = Instance.new("AlignOrientation")

  288. local Position = Instance.new("AlignPosition")

  289. print(Attachment1, Attachment0, Accessory)

  290. Orientation.Attachment0 = Attachment1

  291. Orientation.Attachment1 = Attachment0

  292. Orientation.RigidityEnabled = false

  293. Orientation.ReactionTorqueEnabled = true

  294. Orientation.MaxTorque = 20000

  295. Orientation.Responsiveness = 40

  296. Orientation.Parent = Character.Head

  297. Position.Attachment0 = Attachment1

  298. Position.Attachment1 = Attachment0

  299. Position.RigidityEnabled = false

  300. Position.ReactionForceEnabled = true

  301. Position.MaxForce = 40000

  302. Position.Responsiveness = 40

  303. Position.Parent = Character.Head

  304. end

  305. end

  306. end

  307. end

  308. --[[

  309. Movement

  310. --]]

  311. VirtualRig.Name = "VirtualRig"

  312. VirtualRig.RightFoot.BodyPosition.Position = CharacterCFrame.p

  313. VirtualRig.LeftFoot.BodyPosition.Position = CharacterCFrame.p

  314. VirtualRig.Parent = workspace

  315. VirtualRig:SetPrimaryPartCFrame(CharacterCFrame)

  316. VirtualRig.Humanoid.Health = 0

  317. VirtualRig:BreakJoints()

  318. --

  319. VirtualBody.Parent = workspace

  320. VirtualBody.Name = "VirtualBody"

  321. VirtualBody.Humanoid.WalkSpeed = 8

  322. VirtualBody.Humanoid.CameraOffset = Vector3.new(0, StudsOffset, 0)

  323. VirtualBody:SetPrimaryPartCFrame(CharacterCFrame)

  324. VirtualBody.Humanoid.Died:Connect(function()

  325. print("Virtual death")

  326. if AutoRespawn then

  327. Character:BreakJoints()

  328. if RagdollHeadMovement and RagdollEnabled then

  329. Network:Unclaim()

  330. Respawn()

  331. end

  332. end

  333. end)

  334. --

  335. Camera.CameraSubject = VirtualBody.Humanoid

  336. Character.Humanoid.WalkSpeed = 0

  337. Character.Humanoid.JumpPower = 1

  338. for _, Part in next, VirtualBody:GetChildren() do

  339. if Part:IsA("BasePart") then

  340. Part.Transparency = 1

  341. end

  342. end

  343. for _, Part in next, VirtualRig:GetChildren() do

  344. if Part:IsA("BasePart") then

  345. Part.Transparency = 1

  346. end

  347. end

  348. if not VRReady then

  349. VirtualRig.RightUpperArm.ShoulderConstraint.RigidityEnabled = true

  350. VirtualRig.LeftUpperArm.ShoulderConstraint.RigidityEnabled = true

  351. end

  352. local OnMoving = RunService.Stepped:Connect(function()

  353. local Direction = Character.Humanoid.MoveDirection

  354. local Start = VirtualBody.HumanoidRootPart.Position

  355. local Point = Start + Direction * 6

  356. local Gyro = VirtualBody.HumanoidRootPart:FindFirstChild("BodyGyro") or Instance.new("BodyGyro", VirtualBody.HumanoidRootPart)

  357. Gyro.MaxTorque = Vector3.new(0, 100000, 0)

  358. Gyro.CFrame = Camera:GetRenderCFrame() + Direction

  359. if Pointer.Beam.Enabled then

  360. Point = Pointer.Target.WorldCFrame.p

  361. end

  362. VirtualBody.Humanoid:MoveTo(Point)

  363. end)

  364. Character.Humanoid.Jumping:Connect(function()

  365. VirtualBody.Humanoid.Jump = true

  366. end)

  367. UserInputService.JumpRequest:Connect(function()

  368. VirtualBody.Humanoid.Jump = true

  369. end)

  370. --[[

  371. VR Replication

  372. --]]

  373. if RagdollEnabled then

  374. for _, Part in pairs(Character:GetDescendants()) do

  375. if Part:IsA("BasePart") and Part.Name == "Handle" and Part.Parent:IsA("Accessory") then

  376. Part.LocalTransparencyModifier = 1

  377. elseif Part:IsA("BasePart") and Part.Transparency < 0.5 then

  378. Part.LocalTransparencyModifier = 0.5

  379. end

  380. if not Part:IsA("BasePart") and not Part:IsA("AlignPosition") and not Part:IsA("AlignOrientation") then

  381. pcall(function()

  382. Part.Transparency = 1

  383. end)

  384. pcall(function()

  385. Part.Enabled = false

  386. end)

  387. end

  388. end

  389. end

  390. local FootUpdateDebounce = tick()

  391. local function FloorRay(Part, Distance)

  392. local Position = Part.CFrame.p

  393. local Target = Position - Vector3.new(0, Distance, 0)

  394. local Line = Ray.new(Position, (Target - Position).Unit * Distance)

  395. local FloorPart, FloorPosition, FloorNormal = workspace:FindPartOnRayWithIgnoreList(Line, {VirtualRig, VirtualBody, Character})

  396. if FloorPart then

  397. return FloorPart, FloorPosition, FloorNormal, (FloorPosition - Position).Magnitude

  398. else

  399. return nil, Target, Vector3.new(), Distance

  400. end

  401. end

  402. local function Flatten(CF)

  403. local X,Y,Z = CF.X,CF.Y,CF.Z

  404. local LX,LZ = CF.lookVector.X,CF.lookVector.Z

  405. return CFrame.new(X,Y,Z) * CFrame.Angles(0,math.atan2(LX,LZ),0)

  406. end

  407. local FootTurn = 1

  408. local function FootReady(Foot, Target)

  409. local MaxDist

  410. if Character.Humanoid.MoveDirection.Magnitude > 0 then

  411. MaxDist = .5

  412. else

  413. MaxDist = 1

  414. end

  415. local PastThreshold = (Foot.Position - Target.Position).Magnitude > MaxDist

  416. local PastTick = tick() - FootUpdateDebounce >= 2

  417. if PastThreshold or PastTick then

  418. FootUpdateDebounce = tick()

  419. end

  420. return

  421. PastThreshold

  422. or

  423. PastTick

  424. end

  425. local function FootYield()

  426. local RightFooting = VirtualRig.RightFoot.BodyPosition

  427. local LeftFooting = VirtualRig.LeftFoot.BodyPosition

  428. local LowerTorso = VirtualRig.LowerTorso

  429. local UpperTorso = VirtualRig.UpperTorso

  430. local Timer = 0.15

  431. local Yield = tick()

  432. repeat

  433. RunService.RenderStepped:Wait()

  434. if

  435. math.abs(LowerTorso.Position.Y - RightFooting.Position.Y) > 4

  436. or

  437. math.abs(LowerTorso.Position.Y - LeftFooting.Position.Y) > 4

  438. or

  439. ((UpperTorso.Position - RightFooting.Position) * Vector3.new(1, 0, 1)).Magnitude > VirtualBody.Humanoid.WalkSpeed / 2.5

  440. or

  441. ((UpperTorso.Position - LeftFooting.Position) * Vector3.new(1, 0, 1)).Magnitude > VirtualBody.Humanoid.WalkSpeed / 2.5

  442. then

  443. break

  444. end

  445. until tick() - Yield >= Timer

  446. end

  447. local function UpdateFooting()

  448. if not VirtualRig:FindFirstChild("LowerTorso") then

  449. wait()

  450. return

  451. end

  452. local Floor, FloorPosition, FloorNormal, Dist = FloorRay(VirtualRig.LowerTorso, 3)

  453. Dist = math.clamp(Dist, 0, 5)

  454. local Humanoid = VirtualBody.Humanoid

  455. local MoveDirection = ((Pointer.Target.WorldPosition - VirtualRig.LowerTorso.Position) * Vector3.new(1, 0, 1)).Unit

  456. if not Pointer.Beam.Enabled and Humanoid.MoveDirection.Magnitude == 0 then

  457. MoveDirection = Vector3.new(0, 0, 0)

  458. end

  459. local FootTarget =

  460. VirtualRig.LowerTorso.CFrame *

  461. CFrame.new(FootPlacementSettings.RightOffset) -

  462. Vector3.new(0, Dist, 0) +

  463. MoveDirection * (VirtualBody.Humanoid.WalkSpeed / 4.2)

  464. if FootReady(VirtualRig.RightFoot, FootTarget) then

  465. VirtualRig.RightFoot.BodyPosition.Position = FootTarget.p

  466. VirtualRig.RightFoot.BodyGyro.CFrame = Flatten(VirtualRig.LowerTorso.CFrame)

  467. end

  468. FootYield()

  469. local FootTarget =

  470. VirtualRig.LowerTorso.CFrame *

  471. CFrame.new(FootPlacementSettings.LeftOffset) -

  472. Vector3.new(0, Dist, 0) +

  473. MoveDirection * (VirtualBody.Humanoid.WalkSpeed / 4.2)

  474. if FootReady(VirtualRig.LeftFoot, FootTarget) then

  475. VirtualRig.LeftFoot.BodyPosition.Position = FootTarget.p

  476. VirtualRig.LeftFoot.BodyGyro.CFrame = Flatten(VirtualRig.LowerTorso.CFrame)

  477. end

  478. end

  479. local function UpdateTorsoPosition()

  480. if not RagdollEnabled then

  481. if TorsoHandle then

  482. local Positioning = VirtualRig.UpperTorso.CFrame

  483. if not TorsoGrip or not TorsoGrip.Parent then

  484. TorsoGrip = CreateRightGrip(TorsoHandle)

  485. end

  486. local Parent = TorsoGrip.Parent

  487. TorsoGrip.C1 = CFrame.new()

  488. TorsoGrip.C0 = TorsoGrip.C0:Lerp(WeldBase.CFrame:ToObjectSpace(Positioning * CFrame.new(0, -0.25, 0) * AccessorySettings.LimbOffset), Smoothness)

  489. TorsoGrip.Parent = nil

  490. TorsoGrip.Parent = Parent

  491. end

  492. else

  493. local Positioning = VirtualRig.UpperTorso.CFrame

  494. MoveTorso(Positioning * CFrame.new(0, -0.25, 0))

  495. MoveRoot(Positioning * CFrame.new(0, -0.25, 0))

  496. end

  497. end

  498. local function UpdateLegPosition()

  499. if not RagdollEnabled then

  500. if RightHipHandle then

  501. local Positioning =

  502. VirtualRig.RightLowerLeg.CFrame

  503. : Lerp(VirtualRig.RightFoot.CFrame, 0.5)

  504. + Vector3.new(0, 0.5, 0)

  505. if not RightHipHandle or not RightHipHandle.Parent then

  506. RightLegGrip = CreateRightGrip(RightHipHandle)

  507. end

  508. local Parent = RightLegGrip.Parent

  509. RightLegGrip.C1 = CFrame.new()

  510. RightLegGrip.C0 = RightLegGrip.C0:Lerp(WeldBase.CFrame:ToObjectSpace(Positioning * AccessorySettings.LimbOffset), Smoothness)

  511. RightLegGrip.Parent = nil

  512. RightLegGrip.Parent = Parent

  513. end

  514. if LeftHipHandle then

  515. local Positioning =

  516. VirtualRig.LeftLowerLeg.CFrame

  517. : Lerp(VirtualRig.LeftFoot.CFrame, 0.5)

  518. + Vector3.new(0, 0.5, 0)

  519. if not LeftLegGrip or not LeftLegGrip.Parent then

  520. LeftLegGrip = CreateRightGrip(LeftHipHandle)

  521. end

  522. local Parent = LeftLegGrip.Parent

  523. LeftLegGrip.C1 = CFrame.new()

  524. LeftLegGrip.C0 = LeftLegGrip.C0:Lerp(WeldBase.CFrame:ToObjectSpace(Positioning * AccessorySettings.LimbOffset), Smoothness)

  525. LeftLegGrip.Parent = nil

  526. LeftLegGrip.Parent = Parent

  527. end

  528. else

  529. do

  530. local Positioning =

  531. VirtualRig.RightLowerLeg.CFrame

  532. : Lerp(VirtualRig.RightFoot.CFrame, 0.5)

  533. * CFrame.Angles(0, math.rad(180), 0)

  534. + Vector3.new(0, 0.5, 0)

  535. MoveRightLeg(Positioning)

  536. end

  537. do

  538. local Positioning =

  539. VirtualRig.LeftLowerLeg.CFrame

  540. : Lerp(VirtualRig.LeftFoot.CFrame, 0.5)

  541. * CFrame.Angles(0, math.rad(180), 0)

  542. + Vector3.new(0, 0.5, 0)

  543. MoveLeftLeg(Positioning)

  544. end

  545. end

  546. end

  547. warn("VRReady is", VRReady)

  548. local function OnUserCFrameChanged(UserCFrame, Positioning, IgnoreTorso)

  549. local Positioning = Camera.CFrame * Positioning

  550. if ((VRReady and UserCFrame == Enum.UserCFrame.Head) or not VRReady) and not IgnoreTorso then

  551. UpdateTorsoPosition()

  552. UpdateLegPosition()

  553. end

  554. if not RagdollEnabled then

  555. if UserCFrame == Enum.UserCFrame.Head and AccessorySettings.Head then

  556. for _, Table in next, HeadAccessories do

  557. local Handle, RightGrip, HatAtt, HeadAtt, BasePart = unpack(Table)

  558. local LocalPositioning = Positioning

  559. if not RightGrip or not RightGrip.Parent then

  560. RightGrip = CreateRightGrip(Handle)

  561. Table[2] = RightGrip

  562. end

  563. local Parent = RightGrip.Parent

  564. if BasePart then

  565. LocalPositioning = BasePart.CFrame * HeadAtt

  566. end

  567. RightGrip.C1 = HatAtt

  568. RightGrip.C0 = RightGrip.C0:Lerp(WeldBase.CFrame:ToObjectSpace(LocalPositioning), Smoothness)

  569. RightGrip.Parent = nil

  570. RightGrip.Parent = Parent

  571. end

  572. elseif RightHandle and UserCFrame == Enum.UserCFrame.RightHand and AccessorySettings.RightArm then

  573. local HandPosition = Positioning

  574. local LocalPositioning = Positioning

  575. if not RightHandGrip or not RightHandGrip.Parent then

  576. RightHandGrip = CreateRightGrip(RightHandle)

  577. end

  578. if AccurateHandPosition then

  579. HandPosition = HandPosition * CFrame.new(0, 0, 1)

  580. else

  581. HandPosition = HandPosition * CFrame.new(0, 0, .5)

  582. end

  583. if not VRReady then

  584. local HeadRotation = Camera.CFrame - Camera.CFrame.p

  585. HandPosition = VirtualRig.RightUpperArm.CFrame:Lerp(VirtualRig.RightLowerArm.CFrame, 0.5) * AccessorySettings.LimbOffset

  586. --LocalPositioning = (HeadRotation + (HandPosition * CFrame.new(0, 0, 1)).p) * CFrame.Angles(math.rad(-45), 0, 0)

  587. LocalPositioning = HandPosition * CFrame.new(0, 0, 1) * CFrame.Angles(math.rad(-180), 0, 0)

  588. if Point2 then

  589. VirtualRig.RightUpperArm.Aim.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)

  590. VirtualRig.RightUpperArm.Aim.CFrame = Camera.CFrame * AccessorySettings.LimbOffset

  591. elseif VirtualRig.RightUpperArm.Aim.MaxTorque ~= Vector3.new(0, 0, 0) then

  592. VirtualRig.RightUpperArm.Aim.MaxTorque = Vector3.new(0, 0, 0)

  593. end

  594. elseif not AccurateHandPosition then

  595. LocalPositioning = HandPosition * CFrame.new(0, 0, -1)

  596. end

  597. local Parent = RightHandGrip.Parent

  598. RightHandGrip.C1 = CFrame.new()

  599. RightHandGrip.C0 = RightHandGrip.C0:Lerp(WeldBase.CFrame:ToObjectSpace(HandPosition), Smoothness)

  600. RightHandGrip.Parent = nil

  601. RightHandGrip.Parent = Parent

  602. --

  603. local EquippedTool = GetExtraTool()

  604. if EquippedTool and EquippedTool:FindFirstChild("Handle") then

  605. local EquippedGrip = GetGripForHandle(EquippedTool.Handle)

  606. local Parent = EquippedGrip.Parent

  607. local ArmBaseCFrame = ArmBase.CFrame

  608. if ArmBase.Name == "Right Arm" then

  609. ArmBaseCFrame = ArmBaseCFrame

  610. end

  611. EquippedGrip.C1 = EquippedTool.Grip

  612. EquippedGrip.C0 = EquippedGrip.C0:Lerp(ArmBaseCFrame:ToObjectSpace(LocalPositioning), Smoothness)

  613. EquippedGrip.Parent = nil

  614. EquippedGrip.Parent = Parent

  615. end

  616. elseif LeftHandle and UserCFrame == Enum.UserCFrame.LeftHand and AccessorySettings.LeftArm then

  617. local HandPosition = Positioning

  618. if not LeftHandGrip or not LeftHandGrip.Parent then

  619. LeftHandGrip = CreateRightGrip(LeftHandle)

  620. end

  621. if AccurateHandPosition then

  622. HandPosition = HandPosition * CFrame.new(0, 0, 1)

  623. else

  624. HandPosition = HandPosition * CFrame.new(0, 0, .5)

  625. end

  626. if not VRReady then

  627. HandPosition = VirtualRig.LeftUpperArm.CFrame:Lerp(VirtualRig.LeftLowerArm.CFrame, 0.5) * AccessorySettings.LimbOffset

  628. --warn("Setting HandPosition to hands")

  629. if Point1 then

  630. VirtualRig.LeftUpperArm.Aim.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)

  631. VirtualRig.LeftUpperArm.Aim.CFrame = Camera.CFrame * AccessorySettings.LimbOffset

  632. elseif VirtualRig.LeftUpperArm.Aim.MaxTorque ~= Vector3.new(0, 0, 0) then

  633. VirtualRig.LeftUpperArm.Aim.MaxTorque = Vector3.new(0, 0, 0)

  634. end

  635. end

  636. local Parent = LeftHandGrip.Parent

  637. LeftHandGrip.C1 = CFrame.new()

  638. LeftHandGrip.C0 = LeftHandGrip.C0:Lerp(WeldBase.CFrame:ToObjectSpace(HandPosition), Smoothness)

  639. LeftHandGrip.Parent = nil

  640. LeftHandGrip.Parent = Parent

  641. end

  642. end

  643. if RagdollEnabled then

  644. if UserCFrame == Enum.UserCFrame.Head and RagdollHeadMovement then

  645. MoveHead(Positioning)

  646. elseif UserCFrame == Enum.UserCFrame.RightHand then

  647. local Positioning = Positioning

  648. if not VRReady then

  649. Positioning = VirtualRig.RightUpperArm.CFrame:Lerp(VirtualRig.RightLowerArm.CFrame, 0.5)

  650. elseif AccurateHandPosition then

  651. Positioning = Positioning * CFrame.new(0, 0, 1)

  652. end

  653. if VRReady then

  654. Positioning = Positioning * AccessorySettings.LimbOffset

  655. end

  656. MoveRightArm(Positioning)

  657. if Point2 then

  658. VirtualRig.RightUpperArm.Aim.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)

  659. VirtualRig.RightUpperArm.Aim.CFrame = Camera.CFrame * AccessorySettings.LimbOffset

  660. elseif VirtualRig.RightUpperArm.Aim.MaxTorque ~= Vector3.new(0, 0, 0) then

  661. VirtualRig.RightUpperArm.Aim.MaxTorque = Vector3.new(0, 0, 0)

  662. end

  663. elseif UserCFrame == Enum.UserCFrame.LeftHand then

  664. local Positioning = Positioning

  665. if not VRReady then

  666. Positioning = VirtualRig.LeftUpperArm.CFrame:Lerp(VirtualRig.LeftLowerArm.CFrame, 0.5)

  667. elseif AccurateHandPosition then

  668. Positioning = Positioning * CFrame.new(0, 0, 1)

  669. end

  670. if VRReady then

  671. Positioning = Positioning * AccessorySettings.LimbOffset

  672. end

  673. MoveLeftArm(Positioning)

  674. if Point1 then

  675. VirtualRig.LeftUpperArm.Aim.MaxTorque = Vector3.new(math.huge, math.huge, math.huge)

  676. VirtualRig.LeftUpperArm.Aim.CFrame = Camera.CFrame * AccessorySettings.LimbOffset

  677. elseif VirtualRig.LeftUpperArm.Aim.MaxTorque ~= Vector3.new(0, 0, 0) then

  678. VirtualRig.LeftUpperArm.Aim.MaxTorque = Vector3.new(0, 0, 0)

  679. end

  680. end

  681. end

  682. if UserCFrame == Enum.UserCFrame.Head then

  683. VirtualRig.Head.CFrame = Positioning

  684. VirtualRig.HumanoidRootPart.CFrame = Positioning

  685. elseif UserCFrame == Enum.UserCFrame.RightHand and VRReady then

  686. VirtualRig.RightHand.CFrame = Positioning

  687. elseif UserCFrame == Enum.UserCFrame.LeftHand and VRReady then

  688. VirtualRig.LeftHand.CFrame = Positioning

  689. end

  690. if not VRReady and VirtualRig.LeftHand.Anchored then

  691. VirtualRig.RightHand.Anchored = false

  692. VirtualRig.LeftHand.Anchored = false

  693. elseif VRReady and not VirtualRig.LeftHand.Anchored then

  694. VirtualRig.RightHand.Anchored = true

  695. VirtualRig.LeftHand.Anchored = true

  696. end

  697. end

  698. local CFrameChanged = VRService.UserCFrameChanged:Connect(OnUserCFrameChanged)

  699. local OnStepped = RunService.Stepped:Connect(function()

  700. for _, Part in pairs(VirtualRig:GetChildren()) do

  701. if Part:IsA("BasePart") then

  702. Part.CanCollide = false

  703. end

  704. end

  705. if RagdollEnabled then

  706. for _, Part in pairs(Character:GetChildren()) do

  707. if Part:IsA("BasePart") then

  708. Part.CanCollide = false

  709. end

  710. end

  711. end

  712. if NoCollision then

  713. for _, Player in pairs(Players:GetPlayers()) do

  714. if Player ~= Client and Player.Character then

  715. local Char = Player.Character

  716. local Descendants = Player.Character:GetChildren()

  717. local IsClose, Part = false, Char.PrimaryPart or Char:FindFirstChild("Head") or Char:FindFirstChildWhichIsA("BasePart")

  718. if Part and (Camera.CFrame.Position - Part.Position).Magnitude < 30 then

  719. IsClose = true

  720. end

  721. if IsClose then

  722. for i = 1, #Descendants do

  723. local Part = Descendants[i]

  724. if Part:IsA("BasePart") then

  725. Part.CanCollide = false

  726. Part.Velocity = Vector3.new()

  727. Part.RotVelocity = Vector3.new()

  728. end

  729. end

  730. end

  731. end

  732. end

  733. end

  734. end)

  735. local OnRenderStepped = RunService.Stepped:Connect(function()

  736. Camera.CameraSubject = VirtualBody.Humanoid

  737. if RagdollEnabled then

  738. Character.HumanoidRootPart.CFrame = VirtualRig.UpperTorso.CFrame

  739. Character.HumanoidRootPart.Velocity = Vector3.new(0, 0, 0)

  740. end

  741. if not VRReady then

  742. OnUserCFrameChanged(Enum.UserCFrame.Head, CFrame.new(0, 0, 0))

  743. OnUserCFrameChanged(Enum.UserCFrame.RightHand, CFrame.new(0, 0, 0), true)

  744. OnUserCFrameChanged(Enum.UserCFrame.LeftHand, CFrame.new(0, 0, 0), true)

  745. end

  746. end)

  747. spawn(function()

  748. while Character and Character.Parent do

  749. FootYield()

  750. UpdateFooting()

  751. end

  752. end)

  753. --[[

  754. Non-VR Support + VR Mechanics

  755. --]]

  756. local OnInput = UserInputService.InputBegan:Connect(function(Input, Processed)

  757. if not Processed then

  758. if Input.KeyCode == Enum.KeyCode.LeftControl or Input.KeyCode == Enum.KeyCode.ButtonL2 then

  759. Tween(VirtualBody.Humanoid, "Elastic", "Out", 1, {

  760. CameraOffset = Vector3.new(0, StudsOffset - 1.5, 0)

  761. })

  762. end

  763. if Input.KeyCode == Enum.KeyCode.X then

  764. if RagdollEnabled and RagdollHeadMovement then

  765. Network:Unclaim()

  766. Respawn()

  767. end

  768. end

  769. if Input.KeyCode == Enum.KeyCode.C or Input.KeyCode == Enum.KeyCode.ButtonB then

  770. Pointer.Beam.Enabled = true

  771. Pointer.Target.ParticleEmitter.Enabled = true

  772. elseif Input.KeyCode == Enum.KeyCode.ButtonY then

  773. VirtualBody.Humanoid:MoveTo(Pointer.Target.WorldCFrame.p)

  774. Pointer.Beam.Enabled = true

  775. Pointer.Target.ParticleEmitter.Enabled = true

  776. end

  777. end

  778. if Input.KeyCode == Enum.KeyCode.LeftShift or Input.KeyCode == Enum.KeyCode.ButtonR2 then

  779. Tween(VirtualBody.Humanoid, "Sine", "Out", 1, {

  780. WalkSpeed = 16

  781. })

  782. end

  783. if not VRReady and Input.UserInputType == Enum.UserInputType.MouseButton1 then

  784. Point1 = true

  785. end

  786. if not VRReady and Input.UserInputType == Enum.UserInputType.MouseButton2 then

  787. Point2 = true

  788. end

  789. if VRReady and Input.KeyCode == Enum.KeyCode.ButtonX then

  790. --Character:BreakJoints()

  791. if RagdollEnabled and RagdollHeadMovement then

  792. Character:BreakJoints()

  793. Network:Unclaim()

  794. Respawn()

  795. end

  796. end

  797. end)

  798. local OnInputEnded = UserInputService.InputEnded:Connect(function(Input, Processed)

  799. if not Processed then

  800. if Input.KeyCode == Enum.KeyCode.LeftControl or Input.KeyCode == Enum.KeyCode.ButtonL2 then

  801. Tween(VirtualBody.Humanoid, "Elastic", "Out", 1, {

  802. CameraOffset = Vector3.new(0, StudsOffset, 0)

  803. })

  804. elseif Input.KeyCode == Enum.KeyCode.ButtonB or Input.KeyCode == Enum.KeyCode.C then

  805. if Mouse.Target and (Mouse.Hit.p - Camera.CFrame.p).Magnitude < 1000 then

  806. VirtualBody:MoveTo(Pointer.Target.WorldCFrame.p)

  807. VirtualRig:SetPrimaryPartCFrame(Pointer.Target.WorldCFrame)

  808. VirtualRig.RightFoot.BodyPosition.Position = Pointer.Target.WorldCFrame.p

  809. VirtualRig.LeftFoot.BodyPosition.Position = Pointer.Target.WorldCFrame.p

  810. end

  811. Pointer.Beam.Enabled = false

  812. Pointer.Target.ParticleEmitter.Enabled = false

  813. elseif Input.KeyCode == Enum.KeyCode.ButtonY then

  814. VirtualBody.Humanoid:MoveTo(Pointer.Target.WorldCFrame.p)

  815. Pointer.Beam.Enabled = false

  816. Pointer.Target.ParticleEmitter.Enabled = false

  817. end

  818. end

  819. if Input.KeyCode == Enum.KeyCode.LeftShift or Input.KeyCode == Enum.KeyCode.ButtonR2 then

  820. Tween(VirtualBody.Humanoid, "Sine", "Out", 1, {

  821. WalkSpeed = 8

  822. })

  823. end

  824. if not VRReady and Input.UserInputType == Enum.UserInputType.MouseButton1 then

  825. Point1 = false

  826. end

  827. if not VRReady and Input.UserInputType == Enum.UserInputType.MouseButton2 then

  828. Point2 = false

  829. end

  830. end)

  831. --[[

  832. Proper Cleanup

  833. --]]

  834. local OnReset

  835. OnReset = Client.CharacterAdded:Connect(function()

  836. OnReset:Disconnect();

  837. CFrameChanged:Disconnect();

  838. OnStepped:Disconnect();

  839. OnRenderStepped:Disconnect();

  840. OnMoving:Disconnect();

  841. OnInput:Disconnect();

  842. OnInputEnded:Disconnect();

  843. VirtualRig:Destroy();

  844. VirtualBody:Destroy();

  845. if RagdollEnabled then

  846. Network:Unclaim();

  847. end

  848. if AutoRun then

  849. delay(2, function()

  850. Script()

  851. end)

  852. end

  853. end)

  854. if ChatEnabled then

  855. spawn(ChatHUDFunc)

  856. end

  857. if ViewportEnabled then

  858. spawn(ViewHUDFunc)

  859. end

  860. do

  861. --[[

  862. Functions

  863. --]]

  864. local Players = game:GetService("Players")

  865. local Client = Players.LocalPlayer

  866. local VRService = game:GetService("VRService")

  867. local VRReady = VRService.VREnabled

  868. local UserInputService = game:GetService("UserInputService")

  869. local RunService = game:GetService("RunService")

  870. local Camera = workspace.CurrentCamera

  871. --[[

  872. Code

  873. --]]

  874. if VRReady or true then

  875. Pointer = game:GetObjects("rbxassetid://4476173280")[1]

  876. Pointer.Parent = workspace

  877. Pointer.Beam.Enabled = false

  878. Pointer.Target.ParticleEmitter.Enabled = false

  879. local RenderStepped = RunService.RenderStepped:Connect(function()

  880. if Pointer.Beam.Enabled then

  881. local RightHand = Camera.CFrame * VRService:GetUserCFrame(Enum.UserCFrame.RightHand)

  882. local Target = RightHand * CFrame.new(0, 0, -10)

  883. local Line = Ray.new(RightHand.p, (Target.p - RightHand.p).Unit * 10000)

  884. local Part, Position = workspace:FindPartOnRayWithIgnoreList(Line, {VirtualRig, VirtualBody, Character, Pointer})

  885. local Distance = (Position - RightHand.p).Magnitude

  886. Pointer.Target.Position = Vector3.new(0, 0, -Distance)

  887. Pointer.CFrame = RightHand

  888. end

  889. end)

  890. local Input = UserInputService.InputBegan:Connect(function(Input)

  891. end)

  892. --

  893. local CharacterAdded

  894. CharacterAdded = Client.CharacterAdded:Connect(function()

  895. RenderStepped:Disconnect()

  896. Input:Disconnect()

  897. CharacterAdded:Disconnect()

  898. Pointer:Destroy()

  899. Pointer = nil

  900. end)

  901. else

  902. return

  903. end

  904. end

  905. end;

  906. Permadeath = function()

  907. local ch = game.Players.LocalPlayer.Character

  908. local prt=Instance.new("Model", workspace)

  909. local z1 = Instance.new("Part", prt)

  910. z1.Name="Torso"

  911. z1.CanCollide = false

  912. z1.Anchored = true

  913. local z2 =Instance.new("Part", prt)

  914. z2.Name="Head"

  915. z2.Anchored = true

  916. z2.CanCollide = false

  917. local z3 =Instance.new("Humanoid", prt)

  918. z3.Name="Humanoid"

  919. z1.Position = Vector3.new(0,9999,0)

  920. z2.Position = Vector3.new(0,9991,0)

  921. game.Players.LocalPlayer.Character=prt

  922. wait(5)

  923. warn("50%")

  924. game.Players.LocalPlayer.Character=ch

  925. wait(6)

  926. warn("100%")

  927. end;

  928. Respawn = function()

  929. local ch = game.Players.LocalPlayer.Character

  930. local prt=Instance.new("Model", workspace)

  931. local z1 = Instance.new("Part", prt)

  932. z1.Name="Torso"

  933. z1.CanCollide = false

  934. z1.Anchored = true

  935. local z2 =Instance.new("Part", prt)

  936. z2.Name="Head"

  937. z2.Anchored = true

  938. z2.CanCollide = false

  939. local z3 =Instance.new("Humanoid", prt)

  940. z3.Name="Humanoid"

  941. z1.Position = Vector3.new(0,9999,0)

  942. z2.Position = Vector3.new(0,9991,0)

  943. game.Players.LocalPlayer.Character=prt

  944. wait(5)

  945. game.Players.LocalPlayer.Character=ch

  946. end;

  947. ChatHUDFunc = function()

  948. --[[

  949. Variables

  950. --]]

  951. local UserInputService = game:GetService("UserInputService")

  952. local RunService = game:GetService("RunService")

  953. local VRService = game:GetService("VRService")

  954. local VRReady = VRService.VREnabled

  955. local Players = game:GetService("Players")

  956. local Client = Players.LocalPlayer

  957. local ChatHUD = game:GetObjects("rbxassetid://4476067885")[1]

  958. local GlobalFrame = ChatHUD.GlobalFrame

  959. local Template = GlobalFrame.Template

  960. local LocalFrame = ChatHUD.LocalFrame

  961. local Global = ChatHUD.Global

  962. local Local = ChatHUD.Local

  963. local Camera = workspace.CurrentCamera

  964. Template.Parent = nil

  965. ChatHUD.Parent = game:GetService("CoreGui")

  966. --[[

  967. Code

  968. --]]

  969. local Highlight = Global.Frame.BackgroundColor3

  970. local Deselected = Local.Frame.BackgroundColor3

  971. local OpenGlobalTab = function()

  972. Global.Frame.BackgroundColor3 = Highlight

  973. Local.Frame.BackgroundColor3 = Deselected

  974. Global.Font = Enum.Font.SourceSansBold

  975. Local.Font = Enum.Font.SourceSans

  976. GlobalFrame.Visible = true

  977. LocalFrame.Visible = false

  978. end

  979. local OpenLocalTab = function()

  980. Global.Frame.BackgroundColor3 = Deselected

  981. Local.Frame.BackgroundColor3 = Highlight

  982. Global.Font = Enum.Font.SourceSans

  983. Local.Font = Enum.Font.SourceSansBold

  984. GlobalFrame.Visible = false

  985. LocalFrame.Visible = true

  986. end

  987. Global.MouseButton1Down:Connect(OpenGlobalTab)

  988. Local.MouseButton1Down:Connect(OpenLocalTab)

  989. Global.MouseButton1Click:Connect(OpenGlobalTab)

  990. Local.MouseButton1Click:Connect(OpenLocalTab)

  991. OpenLocalTab()

  992. --

  993. local function GetPlayerDistance(Sender)

  994. if Sender.Character and Sender.Character:FindFirstChild("Head") then

  995. return math.floor((Sender.Character.Head.Position - Camera:GetRenderCFrame().p).Magnitude + 0.5)

  996. end

  997. end

  998. local function NewGlobal(Message, Sender, Color)

  999. local Frame = Template:Clone()

  1000. Frame.Text = ("[%s]: %s"):format(Sender.Name, Message)

  1001. Frame.User.Text = ("[%s]:"):format(Sender.Name)

  1002. Frame.User.TextColor3 = Color

  1003. Frame.BackgroundColor3 = Color

  1004. Frame.Parent = GlobalFrame

  1005. delay(60, function()

  1006. Frame:Destroy()

  1007. end)

  1008. end

  1009. local function NewLocal(Message, Sender, Color, Dist)

  1010. local Frame = Template:Clone()

  1011. Frame.Text = ("(%s) [%s]: %s"):format(tostring(Dist), Sender.Name, Message)

  1012. Frame.User.Text = ("(%s) [%s]:"):format(tostring(Dist), Sender.Name)

  1013. Frame.User.TextColor3 = Color

  1014. Frame.BackgroundColor3 = Color

  1015. Frame.Parent = LocalFrame

  1016. delay(60, function()

  1017. Frame:Destroy()

  1018. end)

  1019. end

  1020. local function OnNewChat(Message, Sender, Color)

  1021. if not ChatHUD or not ChatHUD.Parent then return end

  1022. NewGlobal(Message, Sender, Color)

  1023. local Distance = GetPlayerDistance(Sender)

  1024. if Distance and Distance <= ChatLocalRange then

  1025. NewLocal(Message, Sender, Color, Distance)

  1026. end

  1027. end

  1028. local function OnPlayerAdded(Player)

  1029. if not ChatHUD or not ChatHUD.Parent then return end

  1030. local Color = BrickColor.Random().Color

  1031. Player.Chatted:Connect(function(Message)

  1032. OnNewChat(Message, Player, Color)

  1033. end)

  1034. end

  1035. Players.PlayerAdded:Connect(OnPlayerAdded)

  1036. for _, Player in pairs(Players:GetPlayers()) do

  1037. OnPlayerAdded(Player)

  1038. end

  1039. --

  1040. local ChatPart = ChatHUD.Part

  1041. ChatHUD.Adornee = ChatPart

  1042. if VRReady then

  1043. ChatHUD.Parent = game:GetService("CoreGui")

  1044. ChatHUD.Enabled = true

  1045. ChatHUD.AlwaysOnTop = true

  1046. local OnInput = UserInputService.InputBegan:Connect(function(Input, Processed)

  1047. if not Processed then

  1048. if Input.KeyCode == Enum.KeyCode.ButtonL2 then

  1049. ChatHUD.Enabled = not ChatHUD.Enabled

  1050. end

  1051. end

  1052. end)

  1053. local RenderStepped = RunService.RenderStepped:Connect(function()

  1054. local LeftHand = VRService:GetUserCFrame(Enum.UserCFrame.LeftHand)

  1055. ChatPart.CFrame = Camera.CFrame * LeftHand

  1056. end)

  1057. local CharacterAdded

  1058. CharacterAdded = Client.CharacterAdded:Connect(function()

  1059. OnInput:Disconnect()

  1060. RenderStepped:Disconnect()

  1061. CharacterAdded:Disconnect()

  1062. ChatHUD:Destroy()

  1063. ChatHUD = nil

  1064. end)

  1065. end

  1066. wait(9e9)

  1067. end;

  1068. ViewHUDFunc = function()

  1069. --[[

  1070. Variables

  1071. --]]

  1072. local ViewportRange = ViewportRange or 32

  1073. local UserInputService = game:GetService("UserInputService")

  1074. local RunService = game:GetService("RunService")

  1075. local VRService = game:GetService("VRService")

  1076. local VRReady = VRService.VREnabled

  1077. local Players = game:GetService("Players")

  1078. local Client = Players.LocalPlayer

  1079. local Mouse = Client:GetMouse()

  1080. local Camera = workspace.CurrentCamera

  1081. local CameraPort = Camera.CFrame

  1082. local ViewHUD = script:FindFirstChild("ViewHUD") or game:GetObjects("rbxassetid://4480405425")[1]

  1083. local Viewport = ViewHUD.Viewport

  1084. local Viewcam = Instance.new("Camera")

  1085. local ViewPart = ViewHUD.Part

  1086. ViewHUD.Parent = game:GetService("CoreGui")

  1087. Viewcam.Parent = Viewport

  1088. Viewcam.CameraType = Enum.CameraType.Scriptable

  1089. Viewport.CurrentCamera = Viewcam

  1090. Viewport.BackgroundTransparency = 1

  1091. --[[

  1092. Code

  1093. --]]

  1094. local function Clone(Character)

  1095. local Arc = Character.Archivable

  1096. local Clone;

  1097. Character.Archivable = true

  1098. Clone = Character:Clone()

  1099. Character.Archivable = Arc

  1100. return Clone

  1101. end

  1102. local function GetPart(Name, Parent, Descendants)

  1103. for i = 1, #Descendants do

  1104. local Part = Descendants[i]

  1105. if Part.Name == Name and Part.Parent.Name == Parent then

  1106. return Part

  1107. end

  1108. end

  1109. end

  1110. local function OnPlayerAdded(Player)

  1111. if not ViewHUD or not ViewHUD.Parent then return end

  1112. local function CharacterAdded(Character)

  1113. if not ViewHUD or not ViewHUD.Parent then return end

  1114. Character:WaitForChild("Head")

  1115. Character:WaitForChild("Humanoid")

  1116. wait(3)

  1117. local FakeChar = Clone(Character)

  1118. local TrueRoot = Character:FindFirstChild("HumanoidRootPart") or Character:FindFirstChild("Head")

  1119. local Root = FakeChar:FindFirstChild("HumanoidRootPart") or FakeChar:FindFirstChild("Head")

  1120. local RenderConnection;

  1121. local Descendants = FakeChar:GetDescendants()

  1122. local RealDescendants = Character:GetDescendants()

  1123. local Correspondents = {};

  1124. FakeChar.Humanoid.DisplayDistanceType = "None"

  1125. for i = 1, #Descendants do

  1126. local Part = Descendants[i]

  1127. local Real = Part:IsA("BasePart") and GetPart(Part.Name, Part.Parent.Name, RealDescendants)

  1128. if Part:IsA("BasePart") and Real then

  1129. Part.Anchored = true

  1130. Part:BreakJoints()

  1131. if Part.Parent:IsA("Accessory") then

  1132. Part.Transparency = 0

  1133. end

  1134. table.insert(Correspondents, {Part, Real})

  1135. end

  1136. end

  1137. RenderConnection = RunService.RenderStepped:Connect(function()

  1138. if not Character or not Character.Parent then

  1139. RenderConnection:Disconnect()

  1140. FakeChar:Destroy()

  1141. return

  1142. end

  1143. if (TrueRoot and (TrueRoot.Position - Camera.CFrame.p).Magnitude <= ViewportRange) or Player == Client or not TrueRoot then

  1144. for i = 1, #Correspondents do

  1145. local Part, Real = unpack(Correspondents[i])

  1146. if Part and Real and Part.Parent and Real.Parent then

  1147. Part.CFrame = Real.CFrame

  1148. elseif Part.Parent and not Real.Parent then

  1149. Part:Destroy()

  1150. end

  1151. end

  1152. end

  1153. end)

  1154. FakeChar.Parent = Viewcam

  1155. end

  1156. Player.CharacterAdded:Connect(CharacterAdded)

  1157. if Player.Character then

  1158. spawn(function()

  1159. CharacterAdded(Player.Character)

  1160. end)

  1161. end

  1162. end

  1163. local PlayerAdded = Players.PlayerAdded:Connect(OnPlayerAdded)

  1164. for _, Player in pairs(Players:GetPlayers()) do

  1165. OnPlayerAdded(Player)

  1166. end

  1167. ViewPart.Size = Vector3.new()

  1168. if VRReady then

  1169. Viewport.Position = UDim2.new(.62, 0, .89, 0)

  1170. Viewport.Size = UDim2.new(.3, 0, .3, 0)

  1171. Viewport.AnchorPoint = Vector2.new(.5, 1)

  1172. else

  1173. Viewport.Size = UDim2.new(0.3, 0, 0.3, 0)

  1174. end

  1175. local RenderStepped = RunService.RenderStepped:Connect(function()

  1176. local Render = Camera.CFrame

  1177. local Scale = Camera.ViewportSize

  1178. if VRReady then

  1179. Render = Render * VRService:GetUserCFrame(Enum.UserCFrame.Head)

  1180. end

  1181. CameraPort = CFrame.new(Render.p + Vector3.new(5, 2, 0), Render.p)

  1182. Viewport.Camera.CFrame = CameraPort

  1183. ViewPart.CFrame = Render * CFrame.new(0, 0, -16)

  1184. ViewHUD.Size = UDim2.new(0, Scale.X - 6, 0, Scale.Y - 6)

  1185. end)

  1186. --

  1187. local CharacterAdded

  1188. CharacterAdded = Client.CharacterAdded:Connect(function()

  1189. RenderStepped:Disconnect()

  1190. CharacterAdded:Disconnect()

  1191. PlayerAdded:Disconnect()

  1192. ViewHUD:Destroy()

  1193. ViewHUD = nil

  1194. end)

  1195. wait(9e9)

  1196. end;

  1197. Script()

  1198. wait(9e9)

vr script for roblox clovr - Pastebin.com (2024)

References

Top Articles
Latest Posts
Article information

Author: Arline Emard IV

Last Updated:

Views: 5820

Rating: 4.1 / 5 (72 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Arline Emard IV

Birthday: 1996-07-10

Address: 8912 Hintz Shore, West Louie, AZ 69363-0747

Phone: +13454700762376

Job: Administration Technician

Hobby: Paintball, Horseback riding, Cycling, Running, Macrame, Playing musical instruments, Soapmaking

Introduction: My name is Arline Emard IV, I am a cheerful, gorgeous, colorful, joyous, excited, super, inquisitive person who loves writing and wants to share my knowledge and understanding with you.