I want to make a teleport tool that has a range limit. Issue: I cannot figure out how to make a limit to it and I have looked endlessly throughout the internet trying to find a solution but couldn’t find one. Solutions: I did the magnitude of the character subtracted by the mouse position but I want to make it so that you can also teleport straight up. I also tried clamping each axis of the mouse position and it worked but if the mouse was out of range, the position messed up.
For example, I want it so that if you teleport to the sky, it teleports you [range] studs in that direction if there is no parts covering it.
Sounds like you could use math.max or math.min
Player.pos = math.min(10, (plr.pos - mouse.hitpos).magnitude )
And if ur looking straight up just use If statement?
If mouse.hit == nil then Plr.pos = look vector * range End