Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Part not moving to the correct spot?

This is supposed to spawn parts randomly in, well, random positions, but in a limited space, but it only spawns in one place.


local max = 2100
local Met = script.Projectile:Clone()
local Boom = script.Impact:Clone()
script.Projectile:Destroy()
script.Impact:Destroy()
function DropMeteor()
	print("Dropped")
		local newMet = Met:Clone()
	newMet.Parent = game.Workspace
	newMet.CFrame= CFrame.new(Vector3.new(math.random(max), math.random(500,666),math.random(max)))
	newMet.Anchored = false
	
	wait(math.random(5,33))
	DropMeteor()
end
DropMeteor()
for i = 1,math.random(25) do
	DropMeteor()
end

1 comment

0

FTFY

1 answer

while wait(1) do --Make sure to put in a wait number.
local Part = Instance.new("Part", game.Workspace)
Part.Name = 'FallingBlock'
Part.Position = Vector3.new(math.random(1,100), math.random(1,100),  math.random(1,100)) -- (1,100), 1 = Min, 100 = Max. First math.random is X, second is Y, Third is Z.
end

To make it more simple:

while wait(1) do --Make sure to put in a wait number.
XPos = math.random(1,100)
YPos = math.random(1,100)
ZPos = math.random(1,100)
local Part = Instance.new("Part", game.Workspace)
Part.Name = 'FallingBlock'
Part.Position = Vector3.new(XPos, YPos, ZPos)
end

This discussion is preserved as it was. New answers, comments, and votes are closed.