I actually have already created the variable for tweenservice already throughout the script; if it wasn’t already clear, all parts that were created in the process of structure construction through the script was resized through using tweenservice. If it helps you any this is the entire bit of code so far:
while true do --city gen v0.0.5
wait(1)
local TweenService = game:GetService("TweenService")
local genchance = math.random(1,10)
local positioningx = math.random(-500, 500)
local positioningz = math.random(-500, 500)
local tweenInfo = TweenInfo.new(
5, -- Time
Enum.EasingStyle.Linear, -- EasingStyle
Enum.EasingDirection.Out, -- EasingDirection
0, -- RepeatCount (when less than zero the tween will loop indefinitely)
false, -- Reverses (tween will reverse once reaching it's goal)
0 -- DelayTime
)
if genchance == 10 then
print("city generated at x = "..positioningx.." and z = "..positioningz)
local foundation = Instance.new("Part", game.Workspace)
local capitalmain = Instance.new("Part", game.Workspace)
local column = Instance.new("Part", game.Workspace)
local cmodel = Instance.new("Model", game.Workspace)
local main = Instance.new("Model", game.Workspace) --capital model
cmodel.Name = "Columns"
main.Name = "Capital"
for _, v in pairs(workspace:GetChildren()) do
if v:IsA("BasePart") then
v.Anchored = true
end
end
foundation.Material = "Concrete"
capitalmain.Material = "DiamondPlate"
column.Material = "DiamondPlate"
foundation.Name = "CapitalFoundation"
capitalmain.Name = "TowerPart"
column.Name = "Column1"
column.BrickColor = BrickColor.new("Dark stone grey")
column.Size = Vector3.new(1,1,1)
for i = 2,4 do
local newcolumn = column:Clone()
newcolumn.Parent = workspace.Columns
newcolumn.Name = ("Column"..i)
end
column.Parent = workspace.Columns
foundation.Position = Vector3.new(positioningx, 0, positioningz)
capitalmain.Position = Vector3.new(positioningx, 0, positioningz)
workspace.Columns.Column1.Position = Vector3.new(positioningx + 20, -2, positioningz + 20)
workspace.Columns.Column2.Position = Vector3.new(positioningx - 20, -2, positioningz - 20)
workspace.Columns.Column3.Position = Vector3.new(positioningx - 20, -2, positioningz + 20)
workspace.Columns.Column4.Position = Vector3.new(positioningx + 20, -2, positioningz - 20)
local tween = TweenService:Create(foundation, tweenInfo, {Size = Vector3.new(60,1,60)})
local tween2 = TweenService:Create(capitalmain, tweenInfo, {Size = Vector3.new(40,300,40)})
tween:Play()
tween2:Play()
wait(5)
for i,v in pairs(workspace.Columns:GetChildren()) do
coroutine.wrap(function()
local coltween = TweenService:Create(v, tweenInfo, {Size = Vector3.new(5,308,5)})
coltween:Play()
end)
end
foundation.Parent = main
capitalmain.Parent = main
cmodel.Parent = main -- descend all existing structure parts/models into capital model
end
end