Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Random location cloning help?

Asked by 10 years ago

Can some one help me create a script which will clone a model and put it in a random spot? or maybe help me with the clone it on top of a random voxel or location.

randomlocation = 
for I = 1
randomlocation = math.random(2044, 252, 2044)
model = game.ServerStorage.ShadowEnemy
copy =game.ServerStorage.model:clone-- messed up
copy.parent = game.Workspace
copy.Postion = randomlocation
end

0
It sounds like you are asking us to make a script for you. Please refrain from doing this in the future. FearMeIAmLag 1161 — 10y
0
k (but i dont know how to do that kind of script) chabad360 34 — 10y

2 answers

Log in to vote
0
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
10 years ago
workspace.Model:clone():MoveTo(Vector3.new(math.random(-1000, 1000), 0, math.random(-1000, 1000)))
Ad
Log in to vote
0
Answered by
Sublimus 992 Moderation Voter
10 years ago

So, what you need to start out with is cloning the model,

model = game.Lighting.Modely:clone() -- Location
model.Parent = game.Workspace -- Parent it
model:MakeJoints() -- Keep it from breaking apart

Then you need to position it using :MoveTo() and math.random():

model:MoveTo(Vector3.new(math.random(-512,512), 5, math.random(-512,512))) -- Modify the ranges and the y to your liking

So all together:

model = game.Lighting.Modely:clone() -- Location
model.Parent = game.Workspace -- Parent it
model:MakeJoints() -- Keep it from breaking apart
model:MoveTo(Vector3.new(math.random(-512,512), 5, math.random(-512,512))) -- Modify the ranges and the y to your liking
0
can you add a Z cordinate? chabad360 34 — 10y
0
There is a Z coordinate: Vector3.new(math.random(-512,512) is the X, 5 is the Y, math.random(-512,512) is the Z) Sublimus 992 — 10y
0
oh! chabad360 34 — 10y

Answer this question