IMONLYHERETOFART

Sky Script UPDATED

May 17th, 2025
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | Gaming | 0 0
  1. local ReplicatedStorage = game:GetService("ReplicatedStorage")
  2. local Lighting = game:GetService("Lighting")
  3.  
  4. -- Sky options and spawn weights
  5. local skies = {
  6. {skyModel = ReplicatedStorage.Skies.Sky, weight = 11},
  7. {skyModel = ReplicatedStorage.Skies.GrayCloudSky, weight = 8},
  8. {skyModel = ReplicatedStorage.Skies.RealisticSky, weight = 1}
  9. }
  10.  
  11. -- Total weight
  12. local totalWeight = 0
  13. for _, option in pairs(skies) do
  14. totalWeight += option.weight
  15. end
  16.  
  17. -- Random sky selection
  18. local pick = math.random(1, totalWeight)
  19. local current = 0
  20. local chosenSkyModel
  21.  
  22. for _, option in pairs(skies) do
  23. current += option.weight
  24. if pick <= current then
  25. chosenSkyModel = option.skyModel
  26. break
  27. end
  28. end
  29.  
  30. -- Clear current Lighting and apply new sky and effects
  31. if chosenSkyModel then
  32. Lighting:ClearAllChildren()
  33. for _, item in pairs(chosenSkyModel:GetChildren()) do
  34. local clone = item:Clone()
  35. clone.Parent = Lighting
  36. end
  37. print("Chosen sky:", chosenSkyModel.Name)
  38. end
Advertisement
Add Comment
Please, Sign In to add comment