Advertisement
Xnaate

Universal Visual Glowing Cubes Script!

May 23rd, 2023
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | Gaming | 0 0
  1. -- Define the properties of the cubes
  2. local CUBE_SIZE = 3 -- Replace with the desired size of the cubes
  3. local CUBE_COLOR = Color3.fromRGB(0, 162, 255) -- Replace with the desired color of the cubes
  4. local CUBE_MATERIAL = Enum.Material.Neon -- Replace with the desired material of the cubes
  5. local CUBE_FALL_SPEED = 25 -- Replace with the desired speed of the cube falling
  6. local CUBE_SPAWN_INTERVAL = 1 -- Replace with the desired interval between cube spawns
  7.  
  8. -- Create a function to spawn the cubes
  9. local function spawnCubes()
  10. local cube = Instance.new("Part")
  11. cube.Size = Vector3.new(CUBE_SIZE, CUBE_SIZE, CUBE_SIZE)
  12. cube.Color = CUBE_COLOR
  13. cube.Material = CUBE_MATERIAL
  14. cube.Anchored = false
  15. cube.CanCollide = true
  16. cube.Position = Vector3.new(math.random(-50, 50), 50, math.random(-50, 50))
  17. cube.Parent = game.Workspace
  18.  
  19. local fallVelocity = Vector3.new(0, -CUBE_FALL_SPEED, 0)
  20. cube.Velocity = fallVelocity
  21. end
  22.  
  23. -- Connect the spawning function to a repeating timer
  24. game:GetService("RunService").Heartbeat:Connect(function()
  25. if math.floor(game:GetService("Workspace").DistributedGameTime) % CUBE_SPAWN_INTERVAL == 0 then
  26. spawnCubes()
  27. end
  28. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement