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

How do I make a Model :Clone() but only on a random position of a Baseplate?

Okay so I am currently working on a sword fighting game and there are these Orbs that clone around the map, Called "Timepart12" from ReplicatedStorage.

When you touch them, you get 20 "Time" as a leaderstat.

Sometimes when players walk into them, they get more than that because they sometimes spawn inside of each other, as this script doesn't put them at a specific position.

while true do wait(math.random(30,90)) game.Lighting.Timepart12:Clone().Parent = game.Workspace wait(10) end

so I want to still use a while true do, and make these '"Timepart12"'s :Clone in a random position within a Base plate that is 272, 13, 272 in size.

I am really new to this whole scripting thing so maybe you can provide me with some information inside of the script like what to change.

I would appreciate it! Thank You!

4 comments

0

by randomly clone, I mean (X,Z) not vertically

0

use vector3 with each parameter being math.random with the max being 272 and y being 13

0

can you put that in a script for me im dumb :/

0

hey

2 answers

✓ Accepted answer
while true do 
	wait(math.random(30,90)) 
	local timePart = game.Lighting.Timepart12:Clone()
	timePart.Parent = game.Workspace wait(10) 
	timePart.Position = Vector3.new(math.random(-100, 100), 5, math.random(-100, 100))
-- change -100 and 100 (get x pos of both corners on x side of baseplate) and do same for z
end

2 comments

0

You can get position from placing a part at the corners, also move the y up or down if you want 

0

thank you it works!

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