An invisibility script for the game KAT X: If you die, run the script again. To return to the lobby, simply reset
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