I want to spawn a part inside a box/part with two attachments as the limit. this is what I have so far.
local r = Random.new()
local part = Instance.new("Part")
part.Parent = game.Workspace
part.Anchored = true
local a = script.Parent.Attachment1
local b = script.Parent.Attachment2
while true do
wait(1)
local x = r:NextInteger(1,a.WorldPosition.X - b.WorldPosition.X)
local y = r:NextInteger(1,a.WorldPosition.Y - b.WorldPosition.Y)
local z = r:NextInteger(1,a.WorldPosition.Z - b.WorldPosition.Z)
part.Position = Vector3.new(x,y,z)
end
it does partially work but instead of spawning in between the two points it does it in another location.
