Advertisement
Mautiku

Square light

Sep 13th, 2024
364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.89 KB | None | 0 0
  1. --SQURELIGHT3D
  2. --i was lazy to obfuscate this shi
  3. --btw i hope you like it BY SUSSYY
  4. local player = game.Players.LocalPlayer
  5. local character = player.Character or player.CharacterAdded:Wait()
  6. local head = character:WaitForChild("Head")
  7. local squarePart = Instance.new("Part")
  8. squarePart.Size = Vector3.new(7, 0.1, 7)
  9. squarePart.Anchored = true
  10. squarePart.CanCollide = false
  11. squarePart.Material = Enum.Material.Neon
  12. squarePart.Color = Color3.fromRGB(50, 50, 50)
  13. squarePart.Transparency = 0.5
  14. squarePart.Parent = workspace
  15. local squareLight = Instance.new("PointLight")
  16. squareLight.Brightness = 4
  17. squareLight.Range = 12
  18. squareLight.Enabled = false
  19. squareLight.Parent = squarePart
  20. local hoverSpeed = 0.5
  21. local hoverHeight = 0.5
  22. local timePassed = 0
  23. local isLocked = false
  24. local function updateSquarePosition()
  25. if not isLocked then
  26. local currentHeadPosition = head.Position
  27. local newPosition = currentHeadPosition + Vector3.new(0, 3, 0)
  28. local distance = (squarePart.Position - newPosition).Magnitude
  29. local smoothFactor = 0.1
  30. squarePart.CFrame = CFrame.new(squarePart.Position:Lerp(newPosition, smoothFactor))
  31. end
  32. end
  33. game:GetService("RunService").RenderStepped:Connect(function(deltaTime)
  34. timePassed = timePassed + deltaTime * hoverSpeed
  35. local hoverOffset = math.sin(timePassed) * hoverHeight
  36. updateSquarePosition()
  37. end)
  38. local screenGui = Instance.new("ScreenGui")
  39. screenGui.Parent = player:WaitForChild("PlayerGui")
  40. local toggleButton = Instance.new("TextButton")
  41. toggleButton.Size = UDim2.new(0.2, 0, 0.05, 0)
  42. toggleButton.Position = UDim2.new(0.4, 0, 0.85, 0)
  43. toggleButton.Text = "Toggle Square Light"
  44. toggleButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  45. toggleButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  46. toggleButton.Font = Enum.Font.GothamBold
  47. toggleButton.TextScaled = true
  48. toggleButton.Parent = screenGui
  49. local lockButton = Instance.new("TextButton")
  50. lockButton.Size = UDim2.new(0.2, 0, 0.05, 0)
  51. lockButton.Position = UDim2.new(0.4, 0, 0.75, 0)
  52. lockButton.Text = "Lock Square"
  53. lockButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  54. lockButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  55. lockButton.Font = Enum.Font.GothamBold
  56. lockButton.TextScaled = true
  57. lockButton.Parent = screenGui
  58. toggleButton.MouseButton1Click:Connect(function()
  59. squareLight.Enabled = not squareLight.Enabled
  60. if squareLight.Enabled then
  61. squarePart.Color = Color3.fromRGB(255, 255, 255)
  62. squarePart.Transparency = 0
  63. toggleButton.Text = "Square Light On"
  64. else
  65. squarePart.Color = Color3.fromRGB(0, 0, 0)
  66. squarePart.Transparency = 0.5
  67. toggleButton.Text = "Square Light Off"
  68. end
  69. end)
  70.  
  71. lockButton.MouseButton1Click:Connect(function()
  72. isLocked = not isLocked
  73. if isLocked then
  74. lockButton.Text = "Unlock Square"
  75. else
  76. lockButton.Text = "Lock Square"
  77. end
  78. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement