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