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

How Would I Find The Position of a Model?

So I am trying to make a system that clones the model in a random position. Here is my script:

local spawner = game.ReplicatedStorage.SpawnCage1
local cage = game.ServerStorage.Cage:Clone()
local cage1 = cage:GetChildren()

if spawner.Value == true then
	cage.Parent = workspace
	local position1 = Vector3.new(0,0,0)
	local position2 = Vector3.new(10,0,0)	
	local position3 = Vector3.new(20,0,0)
	local position4 = Vector3.new(30,0,0)
	local chosenPos = {position1,position2,position3,position4}
	cage.Position = math.random(1,#chosenPos)
elseif spawner.Value == false then
	cage.Parent = game.ServerStorage
end

Here is the error in output: 18:23:29.929 - Position is not a valid member of Model

If someone could help me out here that would be very nice. Thanks in advance.

4 answers

✓ Accepted answer

PrimaryPart

How to set a Primary Part for a Model is quite simple...

  1. You click on the model.
  2. You go to PrimaryPart and click.
  3. You click on a part within that model that you want to be the main position of that model. Then your part is done. So when you move your part through a script... it'll move the model as well.

1 comment

1

Wow that was a quick answer lol, I literally just posted this.

Find the position of one of the parts, or average the positions of all of the parts.

Make all the parts a single union and set position of the union!

4 comments

0

Please Accept My Answer If It Works!

0

I can't because some parts have touch functions to specific objects.

0

Do not union all parts, Unions are meant to be used for little edits to bricks... not for giant things.

0

Sorry As I Dont Know Much About Unions

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