You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
Teleport to a target facing them a few studs away. -
What is the issue? Include screenshots / videos if possible!
Don’t know the math to position it that way -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Tried using math and it didnt work
return function(info)
local plr : Player = info.plr
local char : Model = plr.Character
local root : BasePart = char.HumanoidRootPart
local ability = info.ability
local userId : number = plr.UserId or char.UserId.Value
local MouseCf = info.MouseCFrame
local pos = info.cf
local params = RaycastParams.new()
params.FilterDescendantsInstances = {workspace.CharacterHitboxes}
params.FilterType = Enum.RaycastFilterType.Include
local ray = workspace:Raycast(pos, (MouseCf-pos).Unit*150, params)
if ray then
local target = ray.Instance.Character.Value
local humrp = target.HumanoidRootPart
root.Position = ray.Position
root.CFrame = CFrame.lookAt(root.Position, humrp.Position)
end
end
Trying to position it a few studs away from the target.