I am working on a system where the part spawns in the boundaries of another part.
Here is the code for setting the position:
local pos = SpawnPosition(game.Workspace.Baseplate,16)
print(pos)
Model:PivotTo(CFrame.new(pos))
print(Model:GetPivot())
Here is the code of randomly generating the position:
local Pos
local x = math.random(Part.Position.X-(Part.Size.X/2),Part.Position.X+(Part.Size.X/2))
local z = math.random(Part.Position.Z-(Part.Size.Z/2),Part.Position.Z+(Part.Size.Z/2))
local y = height
local y = height
Pos = Vector3.new(x,y,z)
The output is the following:
It shows that it is being set but when I check the model of someone of them they are not there and are just randomly in this area:
this is the nearest model to the border of this weird area (and its position):
Note (the size of the part they are based around is this big):