hello! i’ve been wanting to do a script where a tree is randomly put in a baseplate, but the script isn’t recognizing when i get the position.
code:
placeTree()
function placeTree()
local tree = assets.tree:Clone()
tree:MoveTo(getPosition())
tree.Parent = workspace
end
function getPosition()
local x = Map.Position.X
local xS = Map.Size.X / 2
local y = Map.Position.Y + (Map.Size.Y / 2)
local z = Map.Position.Z
local zS = Map.Size.Z / 2
--
local pos = Vector3.new(math.random(math.min(x - xS), math.max(xS + x)), y, math.random(math.min(z - zS), math.max(zS + z)))
return pos
end