Positioning a Player infront of another Player

Hello,
I’m making something from a popular franchise it requires a certain player to be infront of you to deal damage to them, My script basically checks if what you clicked is a player and positions the player infront you, But here’s where the problem comes in, Regardless of how much I multiply the LookVector with the other player still stays the same distance and its too close, I cant figure out a way to fix this, Any help is appreciated.

HiddenBlade

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()

repeat wait() until character.Humanoid

local Management = script.Parent.Parent
local Anims = Management.Anims
	local FrontStab = character.Humanoid:LoadAnimation(Anims.FrontStab)

local Settings = Management.Settings
	local Damage = Settings.Damage
	local Radius = Settings.Radius
	local Equipped = Settings.Equipped

local Killing = false
local Tool = Management.Parent



Tool.Equipped:Connect(function(mouse)
	mouse.Button1Down:Connect(function()
		if Killing == false and Equipped.Value == true then
			if mouse.Target.Parent:FindFirstChild("Humanoid") then
				local char = mouse.Target.Parent
				if char.Humanoid.Health > 0 then
					local vroot = char.HumanoidRootPart
					vroot.CFrame = character.Torso.CFrame * CFrame.new(0,0,character.Torso.CFrame.LookVector * 10)
				end
			elseif mouse.Target.Parent:IsA("Accessory") or mouse.Target.Parent:IsA("Hat") then
				local char = mouse.Target.Parent.Parent
				
			end
		end
	end)
end)
3 Likes

I think you need to use CFrame:ToWorldSpace() in order to make it relative to the character.

local offset = CFrame.new(0, 0, -5) --negative Z is look vector
vroot.CFrame = character.Torso.CFrame:ToWorldSpace(offset)
2 Likes

You dont need to use the LookVector since multiplying the offset with the target CFrame already gives you a properly rotated CFrame.
vroot.CFrame = character.Torso.CFrame * CFrame.new(0,0,10)

3 Likes