raycast can include terrain, create a raycast facing down from the part and make sure terrain is included in the raycast and set the parts position to the hit poisition + half of the size of the object.
not tested, but this should would
local part = script.Parent
local origin = spawnPosition + Vector3.new(0,10,0)
local rayDirection = Vector3.new(0,-100,0) -- 100 is just the range of the raycast
local raycastParams = RaycastParams.new()
local raycast = workspace:RayCast(origin, direction, raycastParams)
if raycast then
part.Position = raycast.Position + Vector3.new(0,part.Size.Y/2,0)
end
would he better do it on client or server side? because probably hackers would be exploiting onc client side but on the server side how could he do it?