Advertisement
Mr_melonpro

Vr script for roblox

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