Increase LookVector and UpVector at the same Time

So What I need to do, is increase the LookVector and UpVector, when a player shoots a puck. Currently, it only shoots the puck forward, but when I add UpVector, it will only move the puck up or move the puck forward. It will not move Up and Forward.

Current Script for when the Tool is Activated:

    local Part = workspace:WaitForChild("Puck")
	local veo = power * 10
	if enabled == true and workspace:FindFirstChild("Puck") ~= nil then
		if Part:FindFirstChild("Weld") ~= nil then
			Part:FindFirstChild("Weld"):Destroy()
		end
		if veo > 125 then
			veo = 125
		end
		if veo <= 50 then
			script.Parent.Handle.Slap.Volume = 0.5
			script.Parent.Handle.Slap:Play()
		elseif veo >= 50 then
			script.Parent.Handle.Slap.Volume = 1
			script.Parent.Handle.Slap:Play()
		end
		Part.Velocity = script.Parent.Parent:WaitForChild("Torso").CFrame.LookVector * veo
		wait(0.5)
		Part.lpt.Value = ""
		enabled = false
	end

Thanks for your help! :slight_smile:

2 Likes

So your trying to have the puck move forwards and upwards? I’m not entirely sure but you could try

Part.Velocity = script.Parent.Parent:WaitForChild("Torso").CFrame.LookVector * veo + Vector3.new(0,10,0)

This would add a vertical velocity of 10studs/s to the puck

1 Like

That’s the right idea

Part.Velocity = script.Parent.Parent:WaitForChild("Torso").CFrame.LookVector * veo + Vector3.new(0,10,0)

This still didn’t work

Are you trying to make it move diagonally?

If so, you could find the Cross product between the UpVector & LookVector and multiply it by veo.
For example:

local torso = script.Parent.Parent:WaitForChild("Torso")
part.Velocity = torso.CFrame.LookVector:Cross(torso.CFrame.RightVector) * veo
2 Likes

The above post is probably even better but I just tested my method and it seemed to work fine, if the above post is not what your looking for maybe play around with ‘10’ in the Vector3.new(0,10,0), increase its value or something.

EDIT: Nevermid I get what you mean by diagonal. I thought you meant it go where the player WASN’T looking. It works, but it barley goes off the ground. Do I need to increase the veo? And sometimes it’ll go in random directions.

Here’s what it does right now

Turns out this does work, all I had to do was increase the velocity, and fix the weld to make the puck rotated correctly.

Sorry for any confusion, thanks for your help!

FINISHED PRODUCT

1 Like

That’s dope.
Ok wait my method is sort of lacklustre tbh because it will always add a vertical velocity of 10studs/s (or whatever you changed it to) no matter how much veo you give it. Maybe that’s what you want, but an alternative is:

Part.Velocity = (script.Parent.Parent:WaitForChild("Torso").CFrame.LookVector + Vector3.new(0,0.5,0)) * veo

Which I think keeps the angle of elevation constant. Idk, play around with different things and different values and see what works for you, np btw.

2 Likes

This method is better than the last one!

Thanks!