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