hi hello im dumb and i cannot script so i'm asking you people that are way better at this than me for some tiny bit of help, i want to make my game not lag by limiting how many parts the player can spawn at once. i have no clue what i'm doing
local part = script.Parent
local brick = Instance.new("Part", workspace)
local parts = 0
while parts < 30 do
part.ClickDetector.MouseClick:connect(function(player)
parts.Value = parts.Value + 1
brick.Position = game.Workspace.jeff.Position
brick.Material = Enum.Material.Brick
brick.BrickColor = BrickColor.Random()
brick.Transparency = 0
brick.Size = Vector3.new(2, 2, 2)
part.BrickColor = BrickColor.new("Really red") -- this changes the color of the button that player presses to make the bricks
wait(0.1)
part.BrickColor = BrickColor.new("Lime green")
wait(0.1)
wait(30) -- waits a certain amount of time and then destroys the bricks for example if theres too many at once
brick:Destroy()
end)
end
any help would be gladly appreciated i'm losing my mind over this it's probably just a quick easy thing but i'm too incompetent for scripting ok byebye!!

1 comment
Hey green Im going to join add you on roblox so I can help you out