Hey, I’m new to scripting and I couldn’t find a video about this topic on youtube. I want to script different seasons into my game. Like, it changes the map from summer to fall, winter to spring, spring to summer, etc. I was wondering if you guys have any tips on how I should start it.
So, i think you have 2 options
-
build 4 maps, one for each season and subtitute it when the Season changes
-
create 4 variants for the same map, for example change the leafs of a tree from green to orange to White to Pink
For the system i guess you can just do
Season = 0
While true do
Wait(time you want)
If Season == 4 then Season = 0 end
Season = Season + 1
If Season == 1 then
–spring script
Elseif Season == 2 the
– autumn script
And so on
Also some tips, if you want to use the 2nd method you can use Tables to make the color change easier
If you want to use the 1st method you can substitute the trees and make it invisible and slowly become more visible
(Ex. Make the SpringTree slowly become transparent, move the AutumnTree(Transparent) and change his Transparency slowly to 0, this will make a transition between the models, Also when the SpringTree will reach the Transparency of 1 you can move it away)
Hope it helps
I think the first method is just more practical in a sense because you don’t have to worry about certain BaseParts having the same materials others. (Unless you are very good about organizing your BaseParts and feel like you can tediously keep placing them in a specific folder designated for the script alone, then hey more power to you.)
I think the system you gave looks fine, but here’s a few refinements:
local season = 0
while true do
wait(1)
season = 0
season = season + math.random(1,4)
if season == 4 then
-- code
elseif season == 3 then
-- code
elseif season == 2 then
-- code
elseif season == 1 then
-- code
end
end
The script is pretty good but idk if you should use Math.Random, this will make the Season appear randomly instead of cycling
Then we can scratch that and add more additional lines to the conditional statements:
if season == 4 then
season = 1
-- code
elseif season == 3 then
season = 4
-- code
elseif season == 2 then
season = 3
-- code
elseif season == 1 then
season = 2
-- code
end
So it can keep the cycle going every time it loops. @Jxnreve would just have to be sure to define the variable season
outside of the loop as 1 if he wants it to start at summer.
Make sure to mark the solution to let others know that this post has been solved.