I want to teleport player with character:MoveTo() to specific coordinates that always random X, static Y, random Z
The player flings very high no matter what I do
I tried to anchor player, teleport to coordinates above floor, coordinates of floor and coordinates under floor. Player always rockets to the sky
elseif player:HasTag("Boss") then
local BSpawn1 = workspace.Game_Mechanics.CurrentMap.BSpawn1
local BSpawn2 = workspace.Game_Mechanics.CurrentMap.BSpawn2
character:MoveTo(Spawns.Random(BSpawn1.Position.X, BSpawn1.Position.Z, 10, BSpawn2.Position.X, BSpawn2.Position.Z))
character.HumanoidRootPart.CFrame *= CFrame.Angles(0, math.rad(180), 0)
end
This part of code that runs then player is loaded.
local Spawns = {}
function Spawns.Random(X1, Z1, Y, X2, Z2)
local answer = Vector3.new(math.random(X1, X2), Y, math.random(Z2, Z1))
return answer
end
return Spawns
Module that I use in spawn code above (Spawn.Random)
Is this an engine problem or I just don’t understand something?