yoitzErrorYT

rbx invis

Jun 14th, 2023
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.16 KB | None | 0 0
  1. --[[Invisibility Toggle
  2.  
  3.  
  4. This method clones the character locally, teleports the real character to a safe location, then sets the character to the clone.
  5. Basically, your real character is in the sky while you are on the ground.
  6.  
  7.  
  8. Because of the way this works, games with a decent anti-cheat will fuck this up.
  9. If you turn it off, you have to go to a safe place before going invisible.
  10.  
  11. ]]
  12. --Settings:
  13. local ScriptStarted = false
  14. local Keybind = "E" --Set to whatever you want, has to be the name of a KeyCode Enum.
  15. local Transparency = true --Will make you slightly transparent when you are invisible. No reason to disable.
  16. local NoClip = false --Will make your fake character no clip.
  17.  
  18. local Player = game:GetService("Players").LocalPlayer
  19. local RealCharacter = Player.Character or Player.CharacterAdded:Wait()
  20.  
  21. local IsInvisible = false
  22.  
  23. RealCharacter.Archivable = true
  24. local FakeCharacter = RealCharacter:Clone()
  25. local Part
  26. Part = Instance.new("Part", workspace)
  27. Part.Anchored = true
  28. Part.Size = Vector3.new(200, 1, 200)
  29. Part.CFrame = CFrame.new(0, -500, 0) --Set this to whatever you want, just far away from the map.
  30. Part.CanCollide = true
  31. FakeCharacter.Parent = workspace
  32. FakeCharacter.HumanoidRootPart.CFrame = Part.CFrame * CFrame.new(0, 5, 0)
  33.  
  34. for i, v in pairs(RealCharacter:GetChildren()) do
  35.   if v:IsA("LocalScript") then
  36.       local clone = v:Clone()
  37.       clone.Disabled = true
  38.       clone.Parent = FakeCharacter
  39.   end
  40. end
  41. if Transparency then
  42.   for i, v in pairs(FakeCharacter:GetDescendants()) do
  43.       if v:IsA("BasePart") then
  44.           v.Transparency = 0.7
  45.       end
  46.   end
  47. end
  48. local CanInvis = true
  49. function RealCharacterDied()
  50.   CanInvis = false
  51.   RealCharacter:Destroy()
  52.   RealCharacter = Player.Character
  53.   CanInvis = true
  54.   isinvisible = false
  55.   FakeCharacter:Destroy()
  56.   workspace.CurrentCamera.CameraSubject = RealCharacter.Humanoid
  57.  
  58.   RealCharacter.Archivable = true
  59.   FakeCharacter = RealCharacter:Clone()
  60.   Part:Destroy()
  61.   Part = Instance.new("Part", workspace)
  62.   Part.Anchored = true
  63.   Part.Size = Vector3.new(200, 1, 200)
  64.   Part.CFrame = CFrame.new(9999, 9999, 9999) --Set this to whatever you want, just far away from the map.
  65.   Part.CanCollide = true
  66.   FakeCharacter.Parent = workspace
  67.   FakeCharacter.HumanoidRootPart.CFrame = Part.CFrame * CFrame.new(0, 5, 0)
  68.  
  69.   for i, v in pairs(RealCharacter:GetChildren()) do
  70.       if v:IsA("LocalScript") then
  71.           local clone = v:Clone()
  72.           clone.Disabled = true
  73.           clone.Parent = FakeCharacter
  74.       end
  75.   end
  76.   if Transparency then
  77.       for i, v in pairs(FakeCharacter:GetDescendants()) do
  78.           if v:IsA("BasePart") then
  79.               v.Transparency = 0.7
  80.           end
  81.       end
  82.   end
  83.  RealCharacter.Humanoid.Died:Connect(function()
  84.  RealCharacter:Destroy()
  85.  FakeCharacter:Destroy()
  86.  end)
  87.  Player.CharacterAppearanceLoaded:Connect(RealCharacterDied)
  88. end
  89. RealCharacter.Humanoid.Died:Connect(function()
  90.  RealCharacter:Destroy()
  91.  FakeCharacter:Destroy()
  92.  end)
  93. Player.CharacterAppearanceLoaded:Connect(RealCharacterDied)
  94. local PseudoAnchor
  95. game:GetService "RunService".RenderStepped:Connect(
  96.   function()
  97.       if PseudoAnchor ~= nil then
  98.           PseudoAnchor.CFrame = Part.CFrame * CFrame.new(0, 5, 0)
  99.       end
  100.        if NoClip then
  101.       FakeCharacter.Humanoid:ChangeState(11)
  102.        end
  103.   end
  104. )
  105.  
  106. PseudoAnchor = FakeCharacter.HumanoidRootPart
  107. local function Invisible()
  108.   if IsInvisible == false then
  109.       local StoredCF = RealCharacter.HumanoidRootPart.CFrame
  110.       RealCharacter.HumanoidRootPart.CFrame = FakeCharacter.HumanoidRootPart.CFrame
  111.       FakeCharacter.HumanoidRootPart.CFrame = StoredCF
  112.       RealCharacter.Humanoid:UnequipTools()
  113.       Player.Character = FakeCharacter
  114.       workspace.CurrentCamera.CameraSubject = FakeCharacter.Humanoid
  115.       PseudoAnchor = RealCharacter.HumanoidRootPart
  116.       for i, v in pairs(FakeCharacter:GetChildren()) do
  117.           if v:IsA("LocalScript") then
  118.               v.Disabled = false
  119.           end
  120.       end
  121.  
  122.       IsInvisible = true
  123.   else
  124.       local StoredCF = FakeCharacter.HumanoidRootPart.CFrame
  125.       FakeCharacter.HumanoidRootPart.CFrame = RealCharacter.HumanoidRootPart.CFrame
  126.      
  127.       RealCharacter.HumanoidRootPart.CFrame = StoredCF
  128.      
  129.       FakeCharacter.Humanoid:UnequipTools()
  130.       Player.Character = RealCharacter
  131.       workspace.CurrentCamera.CameraSubject = RealCharacter.Humanoid
  132.       PseudoAnchor = FakeCharacter.HumanoidRootPart
  133.       for i, v in pairs(FakeCharacter:GetChildren()) do
  134.           if v:IsA("LocalScript") then
  135.               v.Disabled = true
  136.           end
  137.       end
  138.       IsInvisible = false
  139.   end
  140. end
  141.  
  142. game:GetService("UserInputService").InputBegan:Connect(
  143.   function(key, gamep)
  144.       if gamep then
  145.           return
  146.       end
  147.       if key.KeyCode.Name:lower() == Keybind:lower() and CanInvis and RealCharacter and FakeCharacter then
  148.           if RealCharacter:FindFirstChild("HumanoidRootPart") and FakeCharacter:FindFirstChild("HumanoidRootPart") then
  149.               Invisible()
  150.           end
  151.       end
  152.   end
  153. )
  154. local Sound = Instance.new("Sound",game:GetService("SoundService"))
  155. Sound.SoundId = "rbxassetid://232127604"
  156. Sound:Play()
Tags: lua
Add Comment
Please, Sign In to add comment