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

Instance not new is not a seperate?

So I know your confused about the description so let me explain it every 2 seconds a part is supposed to spawn a part every 2 seconds but instead of spawning a new part every second the part that has been spawned already by the instance.new keeps on getting deleted and coming back meaning only 1 part is being spawned

while wait(2) do
	P = Instance.new("Part")
	P.Parent = workspace
	IntVal = Instance.new("IntValue")
	IntVal.Parent = P
	IntVal.Value = math.random(0,1000)
	IntVal.Name = 'CashValue'
	P.Position = script.Parent.SpawnPart.Position * Vector3.new(0,-1,0)
	
	
end

3 comments

0

i've tested it and it seems to work fine?

0

Have you considered that you're putting the parts all in the same position if script.Parent.SpawnPart never moves? Also, please properly localize your variables.

0

Works normal for me. idk why lol

1 answer

Set the positions of the parts created to random positions:

while true do -- Please do not use while wait() do, it isn't necessary
	wait(2)
	local part = Instance.new("Part")
	part.Position = Vector3.new(math.random(0,256), 1, math.random(0,256)) -- This randomizes the positions assuming you are using a Baseplate
	part.Parent = workspace
	local intval = Instance.new("IntValue")
	intval.Name = "CashValue"
	intval.Value = math.random(1,1000) -- Guaranteed to get at least 1 cash point
	intval.Parent = part
end

If this script doesn't work, we can't help you.

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