local op = Instance.new(“Part”,Workspace)
op.Position = Vector3.new(0, 0, 0) op.Size = Vector3.new(10, 10, 10)
op.AssemblyLinearVelocity = Vector3.new(0, 0, 200)
op.Orientation = game.Players.MarloeG.Character.HumanoidRootPart.Orientation end)
The goal is to make a block shoot out in the direction my character is looking at, but i have absolutely no idea how. I can make it shoot out, and it points torwards the correct direction but it shoots only in the z axis, because i set the AssemblyLinearVelocity at the z axis.
1 Like
How do i rotate the object though?
You can just CFrame the part to the HRP instead of positiioning it. That way you can have the same position and rotation as the HRP.
This is how the code looks now(i erased some “unimportant” lines so its easier to see if i did any errors on the lines that you suggested)
local op = Instance.new(“Part”,Workspace)
local bodythrustForce = Vector3.new(0,0,-1)*forceMagnitudeStrength
local bodyForce = playermodel.HumanoidRootPart.CFrame.LookVector x forceMagnitudeStrength
op.CFrame = CFrame.new(bodyForce)
op.BodyForce = bodyThrustForce end)
The error that i get is “Attempt to perform arithmetic (mul) on Vector3 and nil”