I tried to make a script that tp you to the middle position between two others but it didnt work. I hope i'll know why soon
Here is my script :
local pos1 = game.Workspace.PTest1.Position local pos2 = game.Workspace.PTest2.Position local distance = (pos1 - pos2).magnitude game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(distance / 2)
You can use a function of CFrame
called lerp
With it, you can not only get the middle pos between two position, but pretty much any as long as you provide it as a perecentage.
local pos1 = workspace.PTest1.CFrame local pos2 = workspace.PTest2.CFrame local middlePos = pos1:lerp(pos2, 0.5) --0.5 means 50% therefor the middle game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = middlePos
Roblox has a nice function called DistanceFromCharacter. I'd recommend using it.