Advertisement
The_CheezDev

Roblox Invisibility Toggle Script

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