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.
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)