Making teleport forward script

Hello, i would like to create a teleport forward script. Well, thats pretty simple but i want it to be blocked if there any obstacle in way, so it wont be able get past them. I would like to know any idea how to make it possible

1 Like

Hi, you can use raycasts.

local result = workspace:Raycast(HumanoidRootPart.Position, HumanoidRootPart.CFrame.LookVector + HumanoidRootPart.CFrame)

if (result.Position - HumanoidRootPart.Position).Magnitude <= 2 then --How far your sensitivity you want it to be
  --teleport script

This might not be entirely accurate because I don’t fully remember raycasts, but hopefully you can get started from there

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.