BP.Position prints 0, 0, 0

Hi! So I’m trying to make a Sword-Slash system but for some reason my BodyPosition prints 0, 0, 0 even though I set it to Vector3.new(char.HumanoidRootPart.CFrame.LookVector * 50 + Vector3.new(0, 10, 0))
Code:

local Remote = script.Parent
local Slash = game.ReplicatedStorage.Slash


Remote.OnServerInvoke = function(player)
	--Clone the Slash
	local char = workspace[player.Name]
	local clone = Slash:Clone()
	clone.Parent = workspace
	clone.Position = char.HumanoidRootPart.CFrame.LookVector * 2 + Vector3.new(0, 10, 0)
	local BP = Instance.new("BodyPosition", char)
	BP.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
	BP.Position = Vector3.new(char.HumanoidRootPart.CFrame.LookVector * 50 + Vector3.new(0, 10, 0))
	print(BP.Position) -- prints 0, 0, 0
end

If you want to see the localScript, tell me. :slight_smile:
Thank you!

For some reason Vector3.new(char.HumanoidRootPart.CFrame.LookVector * 50 + Vector3.new(0, 10, 0)) is the same as Vector3.new(0, 0, 0).

if Vector3.new(char.HumanoidRootPart.CFrame.LookVector * 50 + Vector3.new(0, 10, 0)) == Vector3.new(0, 0, 0) then
		print("Yes") --Prints
	end

add the CFrame, example

local NewCFrame = char.HumanoidRootPart.CFrame + char.HumanoidRootPart.CFrame.LookVector * 50
local Position = NewCFrame.Position
print(Position)
1 Like

It still prints 0, 0, 0.
Code:

local Remote = script.Parent
local Slash = game.ReplicatedStorage.Slash
local TweenService = game:GetService("TweenService")


Remote.OnServerInvoke = function(player)
	--Clone the Slash
	local char = workspace[player.Name]
	local clone = Slash:Clone()
	clone.Parent = workspace
	clone.Position = char.HumanoidRootPart.CFrame.LookVector * 2 + Vector3.new(0, 10, 0)
	local BP = Instance.new("BodyPosition", char)
	local NewCFrame = char.HumanoidRootPart.CFrame + char.HumanoidRootPart.CFrame.LookVector * 50
	BP.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
	BP.Position = Vector3.new(NewCFrame.Position + Vector3.new(0, 10, 0))
	print(BP.Position) -- prints 0, 0, 0
end

parent the bodyposition to the humanoidrootpart :+1:

1 Like

Actually, I should’ve parented it to the clone. Thank you though, I just noticed. :smiley: