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.
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.
Find the position of one of the parts, or average the positions of all of the parts.
Use Model:GetPrimaryPartCFrame().p Or Model.PrimaryPart.Position You will need to set a PrimaryPart though https://developer.roblox.com/en-us/api-reference/function/Model/GetPrimaryPartCFrame
Make all the parts a single union and set position of the union!