basically i have this jenga like game but instead of random parts I have models instead
and not all blocks are the same so I already have a random block picker function
local TweenService = game:GetService("TweenService")
local Info = TweenInfo.new(1.5, Enum.EasingStyle.Exponential, Enum.EasingDirection.In)
local StartingPos = CFrame.new(-140, 778, 251) -- X + 14
-- the blocks are 42 long 14 wide and 14 tall
local BlockHeight = 8
-- gets blocks
local BlockFolder = game.ServerStorage.BlockTypes
-- tables for the block picker thing
local Blocks = {
["Climbable"] = BlockFolder.Climbable,
["HND"] = BlockFolder.HND,
["HallWay"] = BlockFolder.HallWay,
-- ["Hollow"] = BlockFolder.Hollow,
["OWL"] = BlockFolder.OWL,
["OWR"] = BlockFolder.OWR,
["OneWay"] = BlockFolder.OneWay,
["SafeRoom"] = BlockFolder.SafeRoom,
["Solid"] = BlockFolder.Solid,
["TrapRoom"] = BlockFolder.TrapRoom
}
local Rarity = {
["Climbable"] = 15, -- 10
["HND"] = 10,
["HallWay"] = 12, --7
-- ["Hollow"] = 15,
["OWL"] = 10,
["OWR"] = 10,
["OneWay"] = 13,
["SafeRoom"] = 21, --16
["Solid"] = 4,
["TrapRoom"] = 15
}
--block picker function using rarities
local function GetRandomByRarity()
local NumRandom = math.random(1, 100)
local counter = 0
for Item, weight in pairs(Rarity) do
counter += weight
if NumRandom <= counter then
return Blocks[Item]
end
end
end
local function Generation()
local LoopedTimes = 0
repeat
local Block = GetRandomByRarity():Clone()
Block.Parent = workspace
Block:PivotTo(StartingPos * CFrame.new(14, 75, 0))
--local Tween = TweenService:Create(Block, Info, {Position = StartingPos * Vector3.new(LoopedTimes * -14, 0, 0)})
--Tween:Play()
-- the tween doesnt work lmao
LoopedTimes += 1
wait(1.5)
until LoopedTimes >= (BlockHeight * 3)
end
-- just to see if the generation works
delay(2, Generation)
The start position is at the side of the platform. If you have ever played blocks n props Iβm trying to achieve the same thing
The problem is that I donβt know what to do and the generation just sucks so can anyone help?