Hello, I made a little script that randomizes clouds randomly!
It’s random in these factors:
- Time between changes
- Amount of change
- Amount of time that it will take to change
Its a pretty simple script and will just add a tad more realism to your game!
I would like it if you post the game you used this in below this post so i can see in what way you used it.
Want to see how it looks before you use it?
Click here!
Setup:
Workspace > Terrain > Add instance ‘Clouds’
ServerScriptService > Add instance ‘Script’
Add the following code to the script in ServerScriptService:
-- [[ Variables ]]
local ts = game:GetService("TweenService")
local clouds = game.Workspace.Terrain.Clouds
-- [[ Functions ]]
function randomwaittime()
local rtime = math.random(30,120)
return rtime
end
function randomtweentime()
local rtime = math.random(5,20)
return rtime
end
function randomcloudcover()
local rcover = math.random(600,800)
return "0."..rcover
end
function changeclouds(tweentime, tweencover)
local tween = ts:Create(clouds, TweenInfo.new(tweentime), { Cover = tonumber(tweencover) }):Play()
end
-- [[ Main ]]
while true do
local tweentime = randomwaittime()
local tweencover = randomcloudcover()
local randomwaittime = randomwaittime()
changeclouds(tweentime, tweencover)
wait(randomwaittime)
end
Enjoy using this!
Sincerely yours,
ClassicSenior