I want my script to teleport me to the "Hostile District" (A place I built in my game) but it teleports me to someplace in the air and far away from where I should teleport.
function onTouch(hit)
local s=math.random(1,2)
if s == 1 then
hit.Parent:MoveTo(Vector3.new(workspace.HostileDistrict.TeleLoc.Position)) -- Hostile District
--elseif s == 2 then
--hit.Parent:MoveTo(Vector3.new(-461.15, 2.05, -11125.091)) -- Sand Box
end
end
script.Parent.Touched:Connect(onTouch)
And when I do it like this:
function onTouch(hit)
local s=math.random(1,2)
if s == 1 then
hit.Parent:MoveTo(Vector3.new(1147.749, -429.55, -103.099)) -- Hostile District
--elseif s == 2 then
--hit.Parent:MoveTo(Vector3.new(-461.15, 2.05, -11125.091)) -- Sand Box
end
end
script.Parent.Touched:Connect(onTouch)
It teleports me a few feet in the air above where I want it.
btw, I've disabled lines 5 and 6 by turning them into comments so it teleports me directly to the Hostile District so I can test its teleport. As for the Sand Box however, it teleports me exactly to the correct spot. Can someone help me with this?
P.S: I tried moving the location then rewriting the position, but it still has the same problem.

1 comment
Nothing happens.