can anyone help me how to make blocks fall randomly from sky
If you want it very simple you could just make a
while wait(TIME_TO_WAIT) do
then just create a part with
Instance.new() with there position being
You can have a block in ServerStorage, then from a ServerScript you can clone that block and keep its “Y” value at a set value like 100, but use math.random() on the x and z position values. For example:
while true do task.wait() local clonedPart = game:GetService("ServerStorage"):WaitForChild("Part"):Clone() clonedPart.Position = Vector3.new(math.random(60,200), 100, math.random(60,200)) clonedPart.Parent = workspace end
while wait(2) do local NewPart = Instance.new("Part") NewPart.Size = Vector3.new(4,4,4) NewPart.Position = Vector3.new(math.random(-100,100),40,math.random(-100,100) NewPart.Parent = workspace --you could also do Debris:AddItem(NewPart, 10) end
Thank you ! it works perfectly but is there any way we can make it fall in a specific area and fall little faster ? thank you in advance
I think this should work.
while true do task.wait() local clonedPart = game:GetService("ServerStorage"):WaitForChild("Part"):Clone() clonedPart.Position = Vector3.new(0,100,0) clonedPart.Parent = workspace end
Sorry for the late response. To make it go faster, I would decrease the wait time, and to make the drop zone more specific, you can make the X and Z values closer to each other. You’ll just have to experiment with those things until you find something you like.
local area = workspace.Baseplate local height = 100 local speed = 1000 --place this inside the loop, if you want it to update in case the part moves --its basically getting the X, Z bounds of the BasePart local minX = area.Position.X-area.Size.X/2 local maxX = area.Position.X+area.Size.X/2 local minZ = area.Position.Z-area.Size.Z/2 local maxZ = area.Position.Z+area.Size.Z/2 local r = math.random while task.wait(1/speed) do local NewPart = Instance.new("Part") NewPart.Size = Vector3.new(4, 4, 4) NewPart.Position = Vector3.new(r(minX, maxX), height, r(minX, maxX)) NewPart.Parent = workspace end