How to make teleport ability with limit ranged?

Hello!
Today i have a question.

How to make a teleport ability with limit ranged ?

Like the limited ranged is 100
if player tried to teleport out of range
then player will be teleported to max range they can teleport,
but if they tried to teleport inside the range then teleport to there.

Sorry for bad english.
Thanks in advance.

math.clamp(value,valuemin,valuemax)

1 Like