R

kloVR

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