Advertisement
ERROR_CODE

X-Ray Tool

Nov 7th, 2024 (edited)
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.74 KB | None | 0 0
  1. XRayVision = Instance.new("Tool")
  2. XRayVision.Name = "X-RayTool"
  3. XRayVision.RequiresHandle = false
  4. XRayVision.Parent = game.Players.LocalPlayer.Backpack
  5.  
  6. local function enableXRay()
  7. for _, Part in pairs(workspace:GetDescendants()) do
  8. if Part:IsA("BasePart") and not Part:IsDescendantOf(game.Players.LocalPlayer.Character) then
  9. Part.Transparency = 0.5
  10. end
  11. end
  12. end
  13.  
  14. local function disableXRay()
  15. for _, Part in pairs(workspace:GetDescendants()) do
  16. if Part:IsA("BasePart") and not Part:IsDescendantOf(game.Players.LocalPlayer.Character) then
  17. Part.Transparency = 0
  18. end
  19. end
  20. end
  21.  
  22. local xRayEnabled = false
  23. XRayVision.Activated:Connect(function()
  24. if xRayEnabled then
  25. disableXRay()
  26. else
  27. enableXRay()
  28. end
  29. xRayEnabled = not xRayEnabled
  30. end)
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement