local Depth = 6
local TargetSpeed = 40
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local RootPart = Character:WaitForChild("HumanoidRootPart")
local ClonePart = RootPart:Clone()
ClonePart.Parent = Character
RootPart.RootJoint.Enabled = false
RootPart.Name = "RHumanoidRootPart"
RootPart.Transparency = 0
local Highlight = Instance.new("Highlight", RootPart)
-- Keep player near ground.
workspace.Gravity = 1000
Humanoid.JumpPower = 0
Character.Animate.Disabled = true
local currentPitch = 0
while task.wait() do
Humanoid.WalkSpeed = TargetSpeed
local velocity = ClonePart.AssemblyLinearVelocity
local horizontalSpeed = Vector2.new(velocity.X, velocity.Z).Magnitude
local targetPitch = 0
if horizontalSpeed > 0.1 then
targetPitch = math.atan2(velocity.Y, horizontalSpeed)
end
currentPitch = currentPitch + (targetPitch - currentPitch) * 0.1
local rotation = CFrame.Angles(math.rad(90) + currentPitch, 0, 0)
RootPart.CFrame = ClonePart.CFrame * CFrame.new(0, -Depth, 0) * rotation
RootPart.Velocity = Vector3.zero
endAn invisibility script for the game KAT X: If you die, run the script again. To return to the lobby, simply reset
No comments yet. Be the first to comment!
1local Depth = 6
2local TargetSpeed = 40
3
4local Players = game:GetService("Players")
5local LocalPlayer = Players.LocalPlayer
6local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
7local Humanoid = Character:WaitForChild("Humanoid")
8local RootPart = Character:WaitForChild("HumanoidRootPart")
9local ClonePart = RootPart:Clone()
10
11ClonePart.Parent = Character
12RootPart.RootJoint.Enabled = false
13RootPart.Name = "RHumanoidRootPart"
14RootPart.Transparency = 0
15local Highlight = Instance.new("Highlight", RootPart)
16
17-- Keep player near ground.
18workspace.Gravity = 1000
19Humanoid.JumpPower = 0
20Character.Animate.Disabled = true
21
22local currentPitch = 0
23while task.wait() do
24 Humanoid.WalkSpeed = TargetSpeed
25 local velocity = ClonePart.AssemblyLinearVelocity
26 local horizontalSpeed = Vector2.new(velocity.X, velocity.Z).Magnitude
27 local targetPitch = 0
28 if horizontalSpeed > 0.1 then
29 targetPitch = math.atan2(velocity.Y, horizontalSpeed)
30 end
31
32 currentPitch = currentPitch + (targetPitch - currentPitch) * 0.1
33 local rotation = CFrame.Angles(math.rad(90) + currentPitch, 0, 0)
34
35 RootPart.CFrame = ClonePart.CFrame * CFrame.new(0, -Depth, 0) * rotation
36 RootPart.Velocity = Vector3.zero
37end