roblox vr script - Pastebin.com (2024)

  1. -- CLOVR - FE FULL-BODY VR SCRIPT, UPDATED ON MARCH 17, 2020, TO SUPPORT ACTUAL CHARACTER USAGE

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

  3. -- | tysm unverified

  4. -- This is an older version of CLOVR, I found that the legs would 'walk' better in this version than the one we released.

  5. --Controls are a bit different from last release because this is older. Still works good!

  6. --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

  7. --|| Settings:

  8. local StudsOffset = 0 -- Character height (negative if you're too high)

  9. local Smoothness = .5 -- Character interpolation (0.1 - 1 = smooth - rigid)

  10. local AnchorCharacter = true -- Prevent physics from causing inconsistencies

  11. local HideCharacter = false -- Hide character on a platform

  12. local NoCollision = true -- Disable player collision

  13. local ChatEnabled = true -- See chat on your left hand in-game

  14. local ChatLocalRange = 75 -- Local chat range

  15. local ViewportEnabled = true -- View nearby players in a frame

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

  17. local RagdollEnabled = true -- Use your character instead of hats (NetworkOwner vulnerability)

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

  19. local AutoRun = false -- Run script on respawn

  20. local AutoRespawn = true -- Kill your real body when your virtual body dies

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

  22. local AccurateHandPosition = true -- Move your Roblox hands according to your real hands

  23. local AccessorySettings = {

  24. LeftArm= "";

  25. RightArm= "";

  26. LeftLeg= "";

  27. RightLeg= "";

  28. Torso= "";

  29. Head= true;

  30. BlockArms= true;

  31. BlockLegs= true;

  32. BlockTorso= true;

  33. LimbOffset= CFrame.Angles(math.rad(90), 0, 0);

  34. }

  35. local FootPlacementSettings = {

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

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

  38. }

  39. --|| Script:

  40. local Script = nil;

  41. Script = function()

  42. --[[

  43. Variables

  44. --]]

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

  46. local Client = Players.LocalPlayer

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

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

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

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

  51. local Mouse = Client:GetMouse()

  52. local Camera = workspace.CurrentCamera

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

  54. local VRReady = VRService.VREnabled

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

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

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

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

  59. local HeadAccessories = {};

  60. local UsedAccessories = {};

  61. local Pointer = false;

  62. local Point1 = false;

  63. local Point2 = false;

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

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

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

  67. Anchor.Anchored = true

  68. Anchor.Transparency = 1

  69. Anchor.CanCollide = false

  70. Anchor.Parent = workspace

  71. if RagdollEnabled then

  72. print("RagdollEnabled, thank you for using CLOVR!")

  73. local NetworkAccess = coroutine.create(function()

  74. settings().Physics.AllowSleep = false

  75. while true do game:GetService("RunService").RenderStepped:Wait()

  76. for _,Players in next, game:GetService("Players"):GetChildren() do

  77. if Players ~= game:GetService("Players").LocalPlayer then

  78. Players.MaximumSimulationRadius = 0.1 Players.SimulationRadius = 0 end end

  79. game:GetService("Players").LocalPlayer.MaximumSimulationRadius = math.pow(math.huge,math.huge)

  80. game:GetService("Players").LocalPlayer.SimulationRadius = math.huge*math.huge end end)

  81. coroutine.resume(NetworkAccess)

  82. end

  83. --[[

  84. Character Protection

  85. --]]

  86. local CharacterCFrame = WeldBase.CFrame

  87. if not RagdollEnabled then

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

  89. Animation:Stop()

  90. end)

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

  92. Track:Stop()

  93. end

  94. if HideCharacter then

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

  96. Platform.Anchored = true

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

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

  99. Platform.Transparency = 1

  100. Platform.Parent = workspace

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

  102. wait(.5)

  103. end

  104. if AnchorCharacter then

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

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

  107. Part.Anchored = true

  108. end

  109. end

  110. end

  111. end

  112. --[[

  113. Functions

  114. --]]

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

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

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

  118. tween.Completed:Connect(function()

  119. tween:Destroy()

  120. end)

  121. tween:Play()

  122. return tween

  123. end

  124. local function GetMotorForLimb(Limb)

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

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

  127. return Motor

  128. end

  129. end

  130. end

  131. local function CreateAlignment(Limb, Part0)

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

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

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

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

  136. Orientation.Attachment0 = Attachment1

  137. Orientation.Attachment1 = Attachment0

  138. Orientation.RigidityEnabled = false

  139. Orientation.MaxTorque = 20000

  140. Orientation.Responsiveness = 40

  141. Orientation.Parent = Character.HumanoidRootPart

  142. Position.Attachment0 = Attachment1

  143. Position.Attachment1 = Attachment0

  144. Position.RigidityEnabled = false

  145. Position.MaxForce = 40000

  146. Position.Responsiveness = 40

  147. Position.Parent = Character.HumanoidRootPart

  148. Limb.Massless = false

  149. local Motor = GetMotorForLimb(Limb)

  150. if Motor then

  151. Motor:Destroy()

  152. end

  153. return function(CF, Local)

  154. if Local then

  155. Attachment0.CFrame = CF

  156. else

  157. Attachment0.WorldCFrame = CF

  158. end

  159. end;

  160. end

  161. local function GetExtraTool()

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

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

  164. return Tool

  165. end

  166. end

  167. end

  168. local function GetGripForHandle(Handle)

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

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

  171. return Weld

  172. end

  173. end

  174. wait(.2)

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

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

  177. return Weld

  178. end

  179. end

  180. end

  181. local function CreateRightGrip(Handle)

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

  183. RightGrip.Name = "RightGrip"

  184. RightGrip.Part1 = Handle

  185. RightGrip.Part0 = WeldBase

  186. RightGrip.Parent = WeldBase

  187. return RightGrip

  188. end

  189. local function CreateAccessory(Accessory, DeleteMeshes)

  190. if not Accessory then

  191. return

  192. end

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

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

  195. local BasePart = HeadAttachment.Parent

  196. local HatAtt = HatAttachment.CFrame

  197. local HeadAtt = HeadAttachment.CFrame

  198. if DeleteMeshes then

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

  200. Accessory.Handle.Mesh:Destroy()

  201. end

  202. end

  203. wait()

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

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

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

  207. Handle:BreakJoints()

  208. else

  209. Handle:BreakJoints()

  210. end

  211. Handle.Massless = true

  212. Handle.Transparency = 0.5

  213. UsedAccessories[Accessory] = true

  214. local RightGrip = CreateRightGrip(Handle)

  215. wait()

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

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

  218. pcall(function()

  219. Object.Transparency = 1

  220. end)

  221. pcall(function()

  222. Object.Enabled = false

  223. end)

  224. end

  225. end

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

  227. end

  228. local function GetHeadAccessories()

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

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

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

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

  233. do

  234. Handle.Transparency = 1

  235. end

  236. if not WearAllAccessories then

  237. break

  238. end

  239. end

  240. end

  241. end

  242. --[[

  243. VR Replication Setup

  244. --]]

  245. if not RagdollEnabled then

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

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

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

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

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

  251. GetHeadAccessories()

  252. elseif RagdollEnabled then

  253. if RagdollHeadMovement then

  254. Permadeath()

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

  256. end

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

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

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

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

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

  262. MoveRoot = CreateAlignment(Character.HumanoidRootPart)

  263. if RagdollHeadMovement then

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

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

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

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

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

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

  270. print(Attachment1, Attachment0, Accessory)

  271. Orientation.Attachment0 = Attachment1

  272. Orientation.Attachment1 = Attachment0

  273. Orientation.RigidityEnabled = false

  274. Orientation.ReactionTorqueEnabled = true

  275. Orientation.MaxTorque = 20000

  276. Orientation.Responsiveness = 40

  277. Orientation.Parent = Character.Head

  278. Position.Attachment0 = Attachment1

  279. Position.Attachment1 = Attachment0

  280. Position.RigidityEnabled = false

  281. Position.ReactionForceEnabled = true

  282. Position.MaxForce = 40000

  283. Position.Responsiveness = 40

  284. Position.Parent = Character.Head

  285. end

  286. end

  287. end

  288. end

  289. --[[

  290. Movement

  291. --]]

  292. VirtualRig.Name = "VirtualRig"

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

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

  295. VirtualRig.Parent = workspace

  296. VirtualRig:SetPrimaryPartCFrame(CharacterCFrame)

  297. VirtualRig.Humanoid.Health = 0

  298. VirtualRig:BreakJoints()

  299. --

  300. VirtualBody.Parent = workspace

  301. VirtualBody.Name = "VirtualBody"

  302. VirtualBody.Humanoid.WalkSpeed = 8

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

  304. VirtualBody:SetPrimaryPartCFrame(CharacterCFrame)

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

  306. print("Virtual death")

  307. if AutoRespawn then

  308. Character:BreakJoints()

  309. if RagdollHeadMovement and RagdollEnabled then

  310. Network:Unclaim()

  311. Respawn()

  312. end

  313. end

  314. end)

  315. --

  316. Camera.CameraSubject = VirtualBody.Humanoid

  317. Character.Humanoid.WalkSpeed = 0

  318. Character.Humanoid.JumpPower = 1

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

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

  321. Part.Transparency = 1

  322. end

  323. end

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

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

  326. Part.Transparency = 1

  327. end

  328. end

  329. if not VRReady then

  330. VirtualRig.RightUpperArm.ShoulderConstraint.RigidityEnabled = true

  331. VirtualRig.LeftUpperArm.ShoulderConstraint.RigidityEnabled = true

  332. end

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

  334. local Direction = Character.Humanoid.MoveDirection

  335. local Start = VirtualBody.HumanoidRootPart.Position

  336. local Point = Start + Direction * 6

  337. VirtualBody.Humanoid:MoveTo(Point)

  338. end)

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

  340. VirtualBody.Humanoid.Jump = true

  341. end)

  342. UserInputService.JumpRequest:Connect(function()

  343. VirtualBody.Humanoid.Jump = true

  344. end)

  345. --[[

  346. VR Replication

  347. --]]

  348. if RagdollEnabled then

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

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

  351. Part.LocalTransparencyModifier = 1

  352. elseif Part:IsA("BasePart") and Part.Transparency < 0.5 and Part.Name ~= "Head" then

  353. Part.LocalTransparencyModifier = 0.5

  354. elseif Part:IsA("BasePart") and Part.Name == "Head" then

  355. Part.LocalTransparencyModifier = 1

  356. end

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

  358. pcall(function()

  359. Part.Transparency = 1

  360. end)

  361. pcall(function()

  362. Part.Enabled = false

  363. end)

  364. end

  365. end

  366. end

  367. local FootUpdateDebounce = tick()

  368. local function FloorRay(Part, Distance)

  369. local Position = Part.CFrame.p

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

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

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

  373. if FloorPart then

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

  375. else

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

  377. end

  378. end

  379. local function Flatten(CF)

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

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

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

  383. end

  384. local FootTurn = 1

  385. local function FootReady(Foot, Target)

  386. local MaxDist

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

  388. MaxDist = .5

  389. else

  390. MaxDist = 1

  391. end

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

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

  394. if PastThreshold or PastTick then

  395. FootUpdateDebounce = tick()

  396. end

  397. return

  398. PastThreshold

  399. or

  400. PastTick

  401. end

  402. local function FootYield()

  403. local RightFooting = VirtualRig.RightFoot.BodyPosition

  404. local LeftFooting = VirtualRig.LeftFoot.BodyPosition

  405. local LowerTorso = VirtualRig.LowerTorso

  406. local Yield = tick()

  407. repeat

  408. RunService.Stepped:Wait()

  409. if

  410. (LowerTorso.Position - RightFooting.Position).Y > 4

  411. or

  412. (LowerTorso.Position - LeftFooting.Position).Y > 4

  413. or

  414. ((LowerTorso.Position - RightFooting.Position) * Vector3.new(1, 0, 1)).Magnitude > 4

  415. or

  416. ((LowerTorso.Position - LeftFooting.Position) * Vector3.new(1, 0, 1)).Magnitude > 4

  417. then

  418. break

  419. end

  420. until tick() - Yield >= .17

  421. end

  422. local function UpdateFooting()

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

  424. wait()

  425. return

  426. end

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

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

  429. local FootTarget =

  430. VirtualRig.LowerTorso.CFrame *

  431. CFrame.new(FootPlacementSettings.RightOffset) -

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

  433. Character.Humanoid.MoveDirection * (VirtualBody.Humanoid.WalkSpeed / 8) * 2

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

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

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

  437. end

  438. FootYield()

  439. local FootTarget =

  440. VirtualRig.LowerTorso.CFrame *

  441. CFrame.new(FootPlacementSettings.LeftOffset) -

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

  443. Character.Humanoid.MoveDirection * (VirtualBody.Humanoid.WalkSpeed / 8) * 2

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

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

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

  447. end

  448. end

  449. local function UpdateTorsoPosition()

  450. if not RagdollEnabled then

  451. if TorsoHandle then

  452. local Positioning = VirtualRig.UpperTorso.CFrame

  453. if not TorsoGrip or not TorsoGrip.Parent then

  454. TorsoGrip = CreateRightGrip(TorsoHandle)

  455. end

  456. local Parent = TorsoGrip.Parent

  457. TorsoGrip.C1 = CFrame.new()

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

  459. TorsoGrip.Parent = nil

  460. TorsoGrip.Parent = Parent

  461. end

  462. else

  463. local Positioning = VirtualRig.UpperTorso.CFrame

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

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

  466. end

  467. end

  468. local function UpdateLegPosition()

  469. if not RagdollEnabled then

  470. if RightHipHandle then

  471. local Positioning =

  472. VirtualRig.RightLowerLeg.CFrame

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

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

  475. if not RightHipHandle or not RightHipHandle.Parent then

  476. RightLegGrip = CreateRightGrip(RightHipHandle)

  477. end

  478. local Parent = RightLegGrip.Parent

  479. RightLegGrip.C1 = CFrame.new()

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

  481. RightLegGrip.Parent = nil

  482. RightLegGrip.Parent = Parent

  483. end

  484. if LeftHipHandle then

  485. local Positioning =

  486. VirtualRig.LeftLowerLeg.CFrame

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

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

  489. if not LeftLegGrip or not LeftLegGrip.Parent then

  490. LeftLegGrip = CreateRightGrip(LeftHipHandle)

  491. end

  492. local Parent = LeftLegGrip.Parent

  493. LeftLegGrip.C1 = CFrame.new()

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

  495. LeftLegGrip.Parent = nil

  496. LeftLegGrip.Parent = Parent

  497. end

  498. else

  499. do

  500. local Positioning =

  501. VirtualRig.RightLowerLeg.CFrame

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

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

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

  505. MoveRightLeg(Positioning)

  506. end

  507. do

  508. local Positioning =

  509. VirtualRig.LeftLowerLeg.CFrame

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

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

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

  513. MoveLeftLeg(Positioning)

  514. end

  515. end

  516. end

  517. warn("VRReady is", VRReady)

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

  519. local Positioning = Camera.CFrame * Positioning

  520. if not IgnoreTorso then

  521. UpdateTorsoPosition()

  522. UpdateLegPosition()

  523. end

  524. if not RagdollEnabled then

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

  526. for _, Table in next, HeadAccessories do

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

  528. local LocalPositioning = Positioning

  529. if not RightGrip or not RightGrip.Parent then

  530. RightGrip = CreateRightGrip(Handle)

  531. Table[2] = RightGrip

  532. end

  533. local Parent = RightGrip.Parent

  534. if BasePart then

  535. LocalPositioning = BasePart.CFrame * HeadAtt

  536. end

  537. RightGrip.C1 = HatAtt

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

  539. RightGrip.Parent = nil

  540. RightGrip.Parent = Parent

  541. end

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

  543. local HandPosition = Positioning

  544. local LocalPositioning = Positioning

  545. if not RightHandGrip or not RightHandGrip.Parent then

  546. RightHandGrip = CreateRightGrip(RightHandle)

  547. end

  548. if AccurateHandPosition then

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

  550. end

  551. if not VRReady then

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

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

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

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

  556. if Point2 then

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

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

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

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

  561. end

  562. elseif AccurateHandPosition then

  563. LocalPositioning = HandPosition

  564. end

  565. local Parent = RightHandGrip.Parent

  566. RightHandGrip.C1 = CFrame.new()

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

  568. RightHandGrip.Parent = nil

  569. RightHandGrip.Parent = Parent

  570. --

  571. local EquippedTool = GetExtraTool()

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

  573. local EquippedGrip = GetGripForHandle(EquippedTool.Handle)

  574. local Parent = EquippedGrip.Parent

  575. local ArmBaseCFrame = ArmBase.CFrame

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

  577. ArmBaseCFrame = ArmBaseCFrame

  578. end

  579. EquippedGrip.C1 = EquippedTool.Grip

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

  581. EquippedGrip.Parent = nil

  582. EquippedGrip.Parent = Parent

  583. end

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

  585. local HandPosition = Positioning

  586. if not LeftHandGrip or not LeftHandGrip.Parent then

  587. LeftHandGrip = CreateRightGrip(LeftHandle)

  588. end

  589. if AccurateHandPosition then

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

  591. end

  592. if not VRReady then

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

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

  595. if Point1 then

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

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

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

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

  600. end

  601. end

  602. local Parent = LeftHandGrip.Parent

  603. LeftHandGrip.C1 = CFrame.new()

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

  605. LeftHandGrip.Parent = nil

  606. LeftHandGrip.Parent = Parent

  607. end

  608. end

  609. if RagdollEnabled then

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

  611. MoveHead(Positioning)

  612. elseif UserCFrame == Enum.UserCFrame.RightHand then

  613. local Positioning = Positioning

  614. if not VRReady then

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

  616. elseif AccurateHandPosition then

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

  618. end

  619. if VRReady then

  620. Positioning = Positioning * AccessorySettings.LimbOffset

  621. end

  622. MoveRightArm(Positioning)

  623. if Point2 then

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

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

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

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

  628. end

  629. elseif UserCFrame == Enum.UserCFrame.LeftHand then

  630. local Positioning = Positioning

  631. if not VRReady then

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

  633. elseif AccurateHandPosition then

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

  635. end

  636. if VRReady then

  637. Positioning = Positioning * AccessorySettings.LimbOffset

  638. end

  639. MoveLeftArm(Positioning)

  640. if Point1 then

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

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

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

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

  645. end

  646. end

  647. end

  648. if UserCFrame == Enum.UserCFrame.Head then

  649. VirtualRig.Head.CFrame = Positioning

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

  651. VirtualRig.RightHand.CFrame = Positioning

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

  653. VirtualRig.LeftHand.CFrame = Positioning

  654. end

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

  656. VirtualRig.RightHand.Anchored = false

  657. VirtualRig.LeftHand.Anchored = false

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

  659. VirtualRig.RightHand.Anchored = true

  660. VirtualRig.LeftHand.Anchored = true

  661. end

  662. end

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

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

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

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

  667. Part.CanCollide = false

  668. end

  669. end

  670. if RagdollEnabled then

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

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

  673. Part.CanCollide = false

  674. end

  675. end

  676. end

  677. if NoCollision then

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

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

  680. local Descendants = Player.Character:GetDescendants()

  681. for i = 1, #Descendants do

  682. local Part = Descendants[i]

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

  684. Part.CanCollide = false

  685. Part.Velocity = Vector3.new()

  686. Part.RotVelocity = Vector3.new()

  687. end

  688. end

  689. end

  690. end

  691. end

  692. end)

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

  694. Camera.CameraSubject = VirtualBody.Humanoid

  695. if RagdollEnabled then

  696. Character.HumanoidRootPart.CFrame = VirtualRig.UpperTorso.CFrame

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

  698. end

  699. if not VRReady then

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

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

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

  703. end

  704. end)

  705. spawn(function()

  706. while Character and Character.Parent do

  707. FootYield()

  708. UpdateFooting()

  709. end

  710. end)

  711. --[[

  712. Non-VR Support + VR Mechanics

  713. --]]

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

  715. if not Processed then

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

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

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

  719. })

  720. end

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

  722. if RagdollEnabled and RagdollHeadMovement then

  723. Network:Unclaim()

  724. Respawn()

  725. end

  726. end

  727. if Input.KeyCode == Enum.KeyCode.C then

  728. VirtualBody:MoveTo(Mouse.Hit.p)

  729. VirtualRig:MoveTo(Mouse.Hit.p)

  730. end

  731. end

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

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

  734. WalkSpeed = 16

  735. })

  736. end

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

  738. Point1 = true

  739. end

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

  741. Point2 = true

  742. end

  743. if VRReady and Input.KeyCode == Enum.KeyCode.ButtonY then

  744. Character:BreakJoints()

  745. if RagdollEnabled and RagdollHeadMovement then

  746. Network:Unclaim()

  747. Respawn()

  748. end

  749. end

  750. end)

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

  752. if not Processed then

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

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

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

  756. })

  757. end

  758. end

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

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

  761. WalkSpeed = 8

  762. })

  763. end

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

  765. Point1 = false

  766. end

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

  768. Point2 = false

  769. end

  770. end)

  771. --[[

  772. Proper Cleanup

  773. --]]

  774. local OnReset

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

  776. OnReset:Disconnect();

  777. CFrameChanged:Disconnect();

  778. OnStepped:Disconnect();

  779. OnRenderStepped:Disconnect();

  780. OnMoving:Disconnect();

  781. OnInput:Disconnect();

  782. OnInputEnded:Disconnect();

  783. VirtualRig:Destroy();

  784. VirtualBody:Destroy();

  785. if RagdollEnabled then

  786. Network:Unclaim();

  787. end

  788. if AutoRun then

  789. delay(2, function()

  790. Script()

  791. end)

  792. end

  793. end)

  794. if ChatEnabled then

  795. spawn(ChatHUDFunc)

  796. end

  797. if ViewportEnabled then

  798. spawn(ViewHUDFunc)

  799. end

  800. do

  801. --[[

  802. Functions

  803. --]]

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

  805. local Client = Players.LocalPlayer

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

  807. local VRReady = VRService.VREnabled

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

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

  810. local Camera = workspace.CurrentCamera

  811. --[[

  812. Code

  813. --]]

  814. if VRReady then

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

  816. Pointer.Parent = workspace

  817. Pointer.Beam.Enabled = false

  818. Pointer.Target.ParticleEmitter.Enabled = false

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

  820. if Pointer.Beam.Enabled then

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

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

  823. local Line = Ray.new(RightHand.p, (Target.p - RightHand.p).Unit * 128)

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

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

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

  827. Pointer.CFrame = RightHand

  828. end

  829. end)

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

  831. if Input.KeyCode == Enum.KeyCode.ButtonB then

  832. Pointer.Beam.Enabled = not Pointer.Beam.Enabled

  833. Pointer.Target.ParticleEmitter.Enabled = not Pointer.Target.ParticleEmitter.Enabled

  834. end

  835. end)

  836. --

  837. local CharacterAdded

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

  839. RenderStepped:Disconnect()

  840. Input:Disconnect()

  841. CharacterAdded:Disconnect()

  842. Pointer:Destroy()

  843. Pointer = nil

  844. end)

  845. else

  846. return

  847. end

  848. end

  849. end;

  850. Permadeath = function()

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

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

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

  854. z1.Name="Torso"

  855. z1.CanCollide = false

  856. z1.Anchored = true

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

  858. z2.Name="Head"

  859. z2.Anchored = true

  860. z2.CanCollide = false

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

  862. z3.Name="Humanoid"

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

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

  865. game.Players.LocalPlayer.Character=prt

  866. wait(5)

  867. warn("50%")

  868. game.Players.LocalPlayer.Character=ch

  869. wait(6)

  870. warn("100%")

  871. end;

  872. Respawn = function()

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

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

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

  876. z1.Name="Torso"

  877. z1.CanCollide = false

  878. z1.Anchored = true

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

  880. z2.Name="Head"

  881. z2.Anchored = true

  882. z2.CanCollide = false

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

  884. z3.Name="Humanoid"

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

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

  887. game.Players.LocalPlayer.Character=prt

  888. wait(5)

  889. game.Players.LocalPlayer.Character=ch

  890. end;

  891. ChatHUDFunc = function()

  892. --[[

  893. Variables

  894. --]]

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

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

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

  898. local VRReady = VRService.VREnabled

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

  900. local Client = Players.LocalPlayer

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

  902. local GlobalFrame = ChatHUD.GlobalFrame

  903. local Template = GlobalFrame.Template

  904. local LocalFrame = ChatHUD.LocalFrame

  905. local Global = ChatHUD.Global

  906. local Local = ChatHUD.Local

  907. local Camera = workspace.CurrentCamera

  908. Template.Parent = nil

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

  910. --[[

  911. Code

  912. --]]

  913. local Highlight = Global.Frame.BackgroundColor3

  914. local Deselected = Local.Frame.BackgroundColor3

  915. local OpenGlobalTab = function()

  916. Global.Frame.BackgroundColor3 = Highlight

  917. Local.Frame.BackgroundColor3 = Deselected

  918. Global.Font = Enum.Font.SourceSansBold

  919. Local.Font = Enum.Font.SourceSans

  920. GlobalFrame.Visible = true

  921. LocalFrame.Visible = false

  922. end

  923. local OpenLocalTab = function()

  924. Global.Frame.BackgroundColor3 = Deselected

  925. Local.Frame.BackgroundColor3 = Highlight

  926. Global.Font = Enum.Font.SourceSans

  927. Local.Font = Enum.Font.SourceSansBold

  928. GlobalFrame.Visible = false

  929. LocalFrame.Visible = true

  930. end

  931. Global.MouseButton1Down:Connect(OpenGlobalTab)

  932. Local.MouseButton1Down:Connect(OpenLocalTab)

  933. Global.MouseButton1Click:Connect(OpenGlobalTab)

  934. Local.MouseButton1Click:Connect(OpenLocalTab)

  935. OpenLocalTab()

  936. --

  937. local function GetPlayerDistance(Sender)

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

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

  940. end

  941. end

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

  943. local Frame = Template:Clone()

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

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

  946. Frame.User.TextColor3 = Color

  947. Frame.BackgroundColor3 = Color

  948. Frame.Parent = GlobalFrame

  949. delay(60, function()

  950. Frame:Destroy()

  951. end)

  952. end

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

  954. local Frame = Template:Clone()

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

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

  957. Frame.User.TextColor3 = Color

  958. Frame.BackgroundColor3 = Color

  959. Frame.Parent = LocalFrame

  960. delay(60, function()

  961. Frame:Destroy()

  962. end)

  963. end

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

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

  966. NewGlobal(Message, Sender, Color)

  967. local Distance = GetPlayerDistance(Sender)

  968. if Distance and Distance <= ChatLocalRange then

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

  970. end

  971. end

  972. local function OnPlayerAdded(Player)

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

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

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

  976. OnNewChat(Message, Player, Color)

  977. end)

  978. end

  979. Players.PlayerAdded:Connect(OnPlayerAdded)

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

  981. OnPlayerAdded(Player)

  982. end

  983. --

  984. local ChatPart = ChatHUD.Part

  985. ChatHUD.Adornee = ChatPart

  986. if VRReady then

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

  988. ChatHUD.Enabled = true

  989. ChatHUD.AlwaysOnTop = true

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

  991. if not Processed then

  992. if Input.KeyCode == Enum.KeyCode.ButtonX then

  993. ChatHUD.Enabled = not ChatHUD.Enabled

  994. end

  995. end

  996. end)

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

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

  999. ChatPart.CFrame = Camera.CFrame * LeftHand

  1000. end)

  1001. local CharacterAdded

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

  1003. OnInput:Disconnect()

  1004. RenderStepped:Disconnect()

  1005. CharacterAdded:Disconnect()

  1006. ChatHUD:Destroy()

  1007. ChatHUD = nil

  1008. end)

  1009. end

  1010. wait(9e9)

  1011. end;

  1012. ViewHUDFunc = function()

  1013. --[[

  1014. Variables

  1015. --]]

  1016. local ViewportRange = ViewportRange or 32

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

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

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

  1020. local VRReady = VRService.VREnabled

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

  1022. local Client = Players.LocalPlayer

  1023. local Mouse = Client:GetMouse()

  1024. local Camera = workspace.CurrentCamera

  1025. local CameraPort = Camera.CFrame

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

  1027. local Viewport = ViewHUD.Viewport

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

  1029. local ViewPart = ViewHUD.Part

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

  1031. Viewcam.Parent = Viewport

  1032. Viewcam.CameraType = Enum.CameraType.Scriptable

  1033. Viewport.CurrentCamera = Viewcam

  1034. Viewport.BackgroundTransparency = 1

  1035. --[[

  1036. Code

  1037. --]]

  1038. local function Clone(Character)

  1039. local Arc = Character.Archivable

  1040. local Clone;

  1041. Character.Archivable = true

  1042. Clone = Character:Clone()

  1043. Character.Archivable = Arc

  1044. return Clone

  1045. end

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

  1047. for i = 1, #Descendants do

  1048. local Part = Descendants[i]

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

  1050. return Part

  1051. end

  1052. end

  1053. end

  1054. local function OnPlayerAdded(Player)

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

  1056. local function CharacterAdded(Character)

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

  1058. Character:WaitForChild("Head")

  1059. Character:WaitForChild("Humanoid")

  1060. wait(3)

  1061. local FakeChar = Clone(Character)

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

  1063. local RenderConnection;

  1064. local Descendants = FakeChar:GetDescendants()

  1065. local RealDescendants = Character:GetDescendants()

  1066. local Correspondents = {};

  1067. FakeChar.Humanoid.DisplayDistanceType = "None"

  1068. for i = 1, #Descendants do

  1069. local Part = Descendants[i]

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

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

  1072. Part.Anchored = true

  1073. Part:BreakJoints()

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

  1075. Part.Transparency = 0

  1076. end

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

  1078. end

  1079. end

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

  1081. if not Character or not Character.Parent then

  1082. RenderConnection:Disconnect()

  1083. FakeChar:Destroy()

  1084. return

  1085. end

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

  1087. for i = 1, #Correspondents do

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

  1089. if Part and Real and Part.Parent and Real.Parent then

  1090. Part.CFrame = Real.CFrame

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

  1092. Part:Destroy()

  1093. end

  1094. end

  1095. end

  1096. end)

  1097. FakeChar.Parent = Viewcam

  1098. end

  1099. Player.CharacterAdded:Connect(CharacterAdded)

  1100. if Player.Character then

  1101. spawn(function()

  1102. CharacterAdded(Player.Character)

  1103. end)

  1104. end

  1105. end

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

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

  1108. OnPlayerAdded(Player)

  1109. end

  1110. ViewPart.Size = Vector3.new()

  1111. if VRReady then

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

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

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

  1115. else

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

  1117. end

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

  1119. local Render = Camera.CFrame

  1120. local Scale = Camera.ViewportSize

  1121. if VRReady then

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

  1123. end

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

  1125. Viewport.Camera.CFrame = CameraPort

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

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

  1128. end)

  1129. --

  1130. local CharacterAdded

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

  1132. RenderStepped:Disconnect()

  1133. CharacterAdded:Disconnect()

  1134. PlayerAdded:Disconnect()

  1135. ViewHUD:Destroy()

  1136. ViewHUD = nil

  1137. end)

  1138. wait(9e9)

  1139. end;

  1140. Script()

  1141. wait(9e9)

roblox vr script - Pastebin.com (2024)
Top Articles
Latest Posts
Article information

Author: Virgilio Hermann JD

Last Updated:

Views: 6238

Rating: 4 / 5 (41 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Virgilio Hermann JD

Birthday: 1997-12-21

Address: 6946 Schoen Cove, Sipesshire, MO 55944

Phone: +3763365785260

Job: Accounting Engineer

Hobby: Web surfing, Rafting, Dowsing, Stand-up comedy, Ghost hunting, Swimming, Amateur radio

Introduction: My name is Virgilio Hermann JD, I am a fine, gifted, beautiful, encouraging, kind, talented, zealous person who loves writing and wants to share my knowledge and understanding with you.