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

How do I make a Part Keep Respawning At a Certain Position?

What script should I use to make a part keep respawning in the position every certain time?

The reason I'm doing this is because I making a game where a part goes somewhere then disappears and I would like it to keep respawning. What script should I use?

1 answer

This can be accomplished by using the Vector3.new userdata, and a simple while loop. First we need to define the part, i'll name mine Part, easy. Next i'll define the position of Part by using the Vector3 userdata that I was talking about, What is Vector3? How do I use it? Vector3 is a group of three values, 1st is the x value(width), 2nd is the y value(height), and last is the z value(depth), Now the while loop, What does it do? The while loop continues looping until theobject defined is nil or false. Now lets set-up our script.

-- note this can be used with a script or a localscript.
while wait() do -- always add a wait(), if not then, it will crash your studio.
	local part -- define location then include a clone method (OBJECTLOCATION:clone())
	part.Position=Vector3.new(partToBegin.Position)+Vector3.new(0,10,0) -- partToBegin is the position the part will start at(so It doesn't spawn at the middle), vector uses studs.
	wait(TimeHere) -- place the time of destroy
	part:remove() -- this removes the object after the `wait` function is over.
end
  • Vector3new link (Link)
  • Loops link (Link)

12 comments

0

I already have the part, should I remove the Instance.new line?

0

Yes, just define the part's location and place a clone method. :clone()

0

I am a beginner at this. Is it OK if you give me the full script, and explain what I have to fill in, please?

0

Oh sure!

0

Thanks

0

I'm confused what to put in "partToBegin", also, when I put the location: "local game.Workspace.Tycoon.Main.Creator1.Handle:clone()", the dot after "game", is underlined.

0

Oh, and by the way, I already have a conveyor belt that destroys the part, I just wanted a script that respawned the part so it can keep destroying .

0

partToBegin places your Part in a certain part's position, then I added 15 studs with it. You have your variable mistaken, should be local part= --location.

0

Oh Ok thank you

0

One last thing, I see this is incorrect, what is wrong with it? part.Position = Vector3.new(18.312, 2.778, 49.123.Position)+Vector3.new(0,10,0)

0

Remove the .Position

0

Oh thanks, but you didn't tell me about my other comment: "Oh, and by the way, I already have a conveyor belt that destroys the part, I just wanted a script that respawned the part so it can keep destroying ."

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