Throwing a object

Hello! I am trying to make a cat that you can throw to deal damage to other players.

I am having issues with this one line of code. The error is invalid argument #3 (Vector3 expected, got CFrame)

Here is the code with the problematic line:

local remote = game.ReplicatedStorage.RemoteEvent

remote.OnServerEvent:Connect(function(player, mouse)
	if not player.Character:FindFirstChild("the man") then return end

	local cat = game.ReplicatedStorage.cat:Clone()
	cat.Parent = workspace
	local offset = Vector3.new(0,0,4) 
	cat.Velocity = player.Character.Head.CFrame*CFrame.new(offset) -- line causing the problem

	game:GetService("Debris"):AddItem(cat, 10)
	
end)
3 Likes

Velocity property uses Vector3, not CFrame

You can do like this:

cat.Velocity = player.Character.Head.Position*offset
1 Like

I think the problem is caused by the velocity because velocity is expecting a vector3 but you gave cframe. try adding .Position at the end of that line.

2 Likes

ok well that works but now the cats are being thrown in one direction, how would i go about making it go where the character is facing

1 Like