The error occurs here bodyForce.Force = ((charPos - vCharPos.unit) * 3000) * (vChar.Torso.CFrame - vChar.Torso.CFrame.p), and according to wiki i can multiply a Vector3 by a CFrame resulting in a Vector3, so i can't see why it would not work in this scenario.

local rangeOfEffect = 20

game:GetService("UserInputService").InputEnded:connect(function(inputObject, gameProcessedEvent)
	
	if inputObject.KeyCode == Enum.KeyCode.R then
		
		local player = game.Players.LocalPlayer
		local vChar = player.Character
		local vCharPos = vChar.Torso.Position
	
		for i,v in pairs(game.Players:GetChildren())do
			if(v.Character ~= vChar)then
				
			
				local charTorso = v.Character.Torso
				local charPos = v.Character.Torso.Position
				
				if((charPos - vCharPos).magnitude <= rangeOfEffect)then
					local bodyForce = Instance.new("BodyForce", charTorso)
					print(vChar.Torso)
					bodyForce.Force = ((charPos - vCharPos.unit)  * 3000) * (vChar.Torso.CFrame - vChar.Torso.CFrame.p)
					bodyForce.Name = "PushForce"
					local ApplyForceScript = script.Parent.DeleteForce:Clone()
					ApplyForceScript.Parent = charTorso
					ApplyForceScript.Disabled = false
				end
			end
		end
	end
end)

2 comments

0

You can do CFrame * Vector3 but not Vector3 * CFrame. CFrame is a position vector with a rotation matrix, and matrix multiplication is not commutative. i.e. if A and B are matrices, then A * B doesn't have to equal B * A.

0

ah you're right thank you