Rocket not firing at the right direction

so i copied a rocket from toolbox and changed it a lot,here’s what it look like:

-----------------
--| Constants |--
-----------------

local GRAVITY_ACCELERATION = workspace.Gravity

local RELOAD_TIME = 3 -- Seconds until tool can be used again
local ROCKET_SPEED = 60 -- Speed of the projectile


local MISSILE_MESH_SCALE = Vector3.new(0.35, 0.35, 0.25)
local ROCKET_PART_SIZE = Vector3.new(1.2, 1.2, 3.27)

-----------------
--| Variables |--
-----------------

local DebrisService = game:GetService('Debris')
local PlayersService = game:GetService('Players')

local MyPlayer

local Tool = script.Parent
local ToolHandle = Tool:WaitForChild("Handle")

local MouseLoc = Tool:WaitForChild("MouseLoc",10)

local RocketScript = script:WaitForChild('Rocket')
local SwooshSound = script:WaitForChild('Swoosh')
local BoomSound = script:WaitForChild('Boom')

--NOTE: We create the rocket once and then clone it when the player fires
local Rocket = Instance.new('Part') do
	-- Set up the rocket part
	Rocket.Name = 'Rocket'
	Rocket.FormFactor = Enum.FormFactor.Custom --NOTE: This must be done before changing Size
	Rocket.Size = ROCKET_PART_SIZE
	Rocket.CanCollide = false

	-- Add the mesh
	local mesh = Instance.new('SpecialMesh', Rocket)

	mesh.Scale = MISSILE_MESH_SCALE

	-- Add fire
	--local fire = Instance.new('Trail', Rocket)
	--fire.Attachment0 = Rocket
	--fire.Attachment1 = r

	-- Add a force to counteract gravity
	local bodyForce = Instance.new('BodyForce', Rocket)
	bodyForce.Name = 'Antigravity'
	bodyForce.Force = Vector3.new(0, Rocket:GetMass() * GRAVITY_ACCELERATION, 0)

	-- Clone the sounds and set Boom to PlayOnRemove
	local swooshSoundClone = SwooshSound:Clone()
	swooshSoundClone.Parent = Rocket
	local boomSoundClone = BoomSound:Clone()
	boomSoundClone.PlayOnRemove = true
	boomSoundClone.Parent = Rocket

	-- Attach creator tags to the rocket early on
	local creatorTag = Instance.new('ObjectValue', Rocket)
	creatorTag.Value = MyPlayer
	creatorTag.Name = 'creator' --NOTE: Must be called 'creator' for website stats
	local iconTag = Instance.new('StringValue', creatorTag)
	iconTag.Value = Tool.TextureId
	iconTag.Name = 'icon'

	-- Finally, clone the rocket script and enable it
	local rocketScriptClone = RocketScript:Clone()
	rocketScriptClone.Parent = Rocket
	rocketScriptClone.Disabled = false
end

-----------------
--| Functions |--
-----------------

local function OnActivated()
	local myModel = MyPlayer.Character
	if Tool.Enabled and myModel and myModel:FindFirstChildOfClass("Humanoid") and myModel.Humanoid.Health > 0 then
		Tool.Enabled = false
		local Pos = MouseLoc:InvokeClient(MyPlayer)
		-- Create a clone of Rocket and set its color
		local rocketClone = Rocket:Clone()
		DebrisService:AddItem(rocketClone, 30)
		rocketClone.BrickColor = BrickColor.Black()

		-- Position the rocket clone and launch!
		local spawnPosition = (ToolHandle.CFrame * CFrame.new(5, 0, 0)).p
		rocketClone.CFrame = CFrame.new(spawnPosition) --I CHANGED IT TO ONLY SPAWN POSITION, THIS WAS SPAWNPOSITION + POS,
		rocketClone.Velocity = rocketClone.CFrame.lookVector * ROCKET_SPEED --NOTE: This should be done before assigning Parent
		rocketClone.Parent = workspace
		rocketClone:SetNetworkOwner(nil)

		wait(RELOAD_TIME)

		Tool.Enabled = true
	end
end

function OnEquipped()
	MyPlayer = PlayersService:GetPlayerFromCharacter(Tool.Parent)
end

--------------------
--| Script Logic |--
--------------------

Tool.Equipped:Connect(OnEquipped)
Tool.Activated:Connect(OnActivated)

but now it only fires in one direction, no matter where I fire it.

I can see that you have an Interesting Script here, what is the local Pos in the OnActivated function exactly?

maybe if you change rocketClone.CFrame = CFrame.new(spawnPosition) to rocketClone.CFrame = CFrame.new(spawnPosition+Pos) like it was before it may work

well…i cahanged it two times, before it was this:

local Tool = script.Parent

local Remote = Tool:WaitForChild("MouseLoc")

local Mouse = game.Players.LocalPlayer:GetMouse()

function Remote.OnClientInvoke()
	return Mouse.Hit.p
end

and i changed it to this

local Tool = script.Parent

local Remote = Tool:WaitForChild("MouseLoc")

local Mouse = game.Players.LocalPlayer:GetMouse()

function Remote.OnClientInvoke()
	return Mouse.Hit.LookVector * Vector3.new(1, 0, 1)
end

i did that, but it just explodes where i click, i want it to go stright that direction

Hmm okay so basically maybe you can move it forward a bit. So maybe try this instead rocketClone.CFrame = CFrame.new(spawnPosition) * CFrame.new(Pos) * CFrame.new(2,0,0)

Or you could change the Line below that to rocketClone.Velocity = Pos * ROCKET_SPEED

huh, seems like nothing changed

hm that is weird maybe you could try the one I just said


heres what it looks like

Did you try rocketClone.Velocity = Pos * ROCKET_SPEED yet?

yea it looks like this

What is Rocket script? because for me it works fine

Maybe you could just remove everything inside the Script called “Rocket”

well i guess you can see the model yourself, i just searched “rocket launcher” and grabbed the first one

Okay, just 1 moment I need to see what is “Rocket”

I think if you change the entire “Server” script to: -----------------
–| Constants |–

local GRAVITY_ACCELERATION = workspace.Gravity

local RELOAD_TIME = 3 – Seconds until tool can be used again
local ROCKET_SPEED = 60 – Speed of the projectile

local MISSILE_MESH_SCALE = Vector3.new(0.35, 0.35, 0.25)
local ROCKET_PART_SIZE = Vector3.new(1.2, 1.2, 3.27)


–| Variables |–

local DebrisService = game:GetService(‘Debris’)
local PlayersService = game:GetService(‘Players’)

local MyPlayer

local Tool = script.Parent
local ToolHandle = Tool:WaitForChild(“Handle”)

local MouseLoc = Tool:WaitForChild(“MouseLoc”,10)

local RocketScript = script:WaitForChild(‘Rocket’)
local SwooshSound = script:WaitForChild(‘Swoosh’)
local BoomSound = script:WaitForChild(‘Boom’)

–NOTE: We create the rocket once and then clone it when the player fires
local Rocket = Instance.new(‘Part’) do
– Set up the rocket part
Rocket.Name = ‘Rocket’
Rocket.FormFactor = Enum.FormFactor.Custom --NOTE: This must be done before changing Size
Rocket.Size = ROCKET_PART_SIZE
Rocket.CanCollide = false

-- Add the mesh
local mesh = Instance.new('SpecialMesh', Rocket)

mesh.Scale = MISSILE_MESH_SCALE

-- Add fire
--local fire = Instance.new('Trail', Rocket)
--fire.Attachment0 = Rocket
--fire.Attachment1 = r

-- Add a force to counteract gravity
local bodyForce = Instance.new('BodyForce', Rocket)
bodyForce.Name = 'Antigravity'
bodyForce.Force = Vector3.new(0, Rocket:GetMass() * GRAVITY_ACCELERATION, 0)

-- Clone the sounds and set Boom to PlayOnRemove
local swooshSoundClone = SwooshSound:Clone()
swooshSoundClone.Parent = Rocket
local boomSoundClone = BoomSound:Clone()
boomSoundClone.PlayOnRemove = true
boomSoundClone.Parent = Rocket

-- Attach creator tags to the rocket early on
local creatorTag = Instance.new('ObjectValue', Rocket)
creatorTag.Value = MyPlayer
creatorTag.Name = 'creator' --NOTE: Must be called 'creator' for website stats
local iconTag = Instance.new('StringValue', creatorTag)
iconTag.Value = Tool.TextureId
iconTag.Name = 'icon'

-- Finally, clone the rocket script and enable it
local rocketScriptClone = RocketScript:Clone()
rocketScriptClone.Parent = Rocket
rocketScriptClone.Disabled = false

end


–| Functions |–

local function OnActivated()
local myModel = MyPlayer.Character
if Tool.Enabled and myModel and myModel:FindFirstChildOfClass(“Humanoid”) and myModel.Humanoid.Health > 0 then
Tool.Enabled = false
local Pos = MouseLoc:InvokeClient(MyPlayer)
– Create a clone of Rocket and set its color
local rocketClone = Rocket:Clone()
DebrisService:AddItem(rocketClone, 30)
rocketClone.BrickColor = BrickColor.Black()

	-- Position the rocket clone and launch!
	local spawnPosition = (ToolHandle.CFrame * CFrame.new(5, 0, 0)).p
	rocketClone.CFrame = CFrame.new(spawnPosition) --I CHANGED IT TO ONLY SPAWN POSITION, THIS WAS SPAWNPOSITION + POS,
	rocketClone.Velocity = Pos * ROCKET_SPEED --NOTE: This should be done before assigning Parent
	rocketClone.Parent = workspace
	rocketClone:SetNetworkOwner(nil)

	wait(RELOAD_TIME)

	Tool.Enabled = true
end

end

function OnEquipped()
MyPlayer = PlayersService:GetPlayerFromCharacter(Tool.Parent)
end


–| Script Logic |–

Tool.Equipped:Connect(OnEquipped)
Tool.Activated:Connect(OnActivated) it should work

Actually just change the OnActivated() function to local function OnActivated()
local myModel = MyPlayer.Character
if Tool.Enabled and myModel and myModel:FindFirstChildOfClass(“Humanoid”) and myModel.Humanoid.Health > 0 then
Tool.Enabled = false
local Pos = MouseLoc:InvokeClient(MyPlayer)
local rocketClone = Rocket:Clone()
DebrisService:AddItem(rocketClone, 30)
rocketClone.BrickColor = BrickColor.Black()
local spawnPosition = (ToolHandle.CFrame * CFrame.new(5, 0, 0)).p
rocketClone.CFrame = CFrame.new(spawnPosition)
rocketClone.Velocity = Pos * ROCKET_SPEED
rocketClone.Parent = workspace
rocketClone:SetNetworkOwner(nil)
wait(RELOAD_TIME)
Tool.Enabled = true
end
end

a this was hard anyways i manged to change the studio fonts
so li look like this?

local GRAVITY_ACCELERATION = workspace.Gravity

local RELOAD_TIME = 3 
local ROCKET_SPEED = 60

local MISSILE_MESH_SCALE = Vector3.new(0.35, 0.35, 0.25)
local ROCKET_PART_SIZE = Vector3.new(1.2, 1.2, 3.27)


local DebrisService = game:GetService('Debris')
local PlayersService = game:GetService("Players")

local MyPlayer

local Tool = script.Parent
local ToolHandle = Tool:WaitForChild('Handle')

local MouseLoc = Tool:WaitForChild("MouseLoc",10)

local RocketScript = script:WaitForChild("Rocket")
local SwooshSound = script:WaitForChild("Swoosh")
local BoomSound = script:WaitForChild("Boom")


	local Rocket = Instance.new("Part") do
	
		Rocket.Name = "Rocket"
		Rocket.FormFactor = Enum.FormFactor.Custom --NOTE: This must be done before changing Size
		Rocket.Size = ROCKET_PART_SIZE
		Rocket.CanCollide = false

		-- Add the mesh
		local mesh = Instance.new('SpecialMesh', Rocket)

		mesh.Scale = MISSILE_MESH_SCALE

		-- Add fire
		--local fire = Instance.new('Trail', Rocket)
		--fire.Attachment0 = Rocket
		--fire.Attachment1 = r

		-- Add a force to counteract gravity
		local bodyForce = Instance.new('BodyForce', Rocket)
		bodyForce.Name = 'Antigravity'
		bodyForce.Force = Vector3.new(0, Rocket:GetMass() * GRAVITY_ACCELERATION, 0)

		-- Clone the sounds and set Boom to PlayOnRemove
		local swooshSoundClone = SwooshSound:Clone()
		swooshSoundClone.Parent = Rocket
		local boomSoundClone = BoomSound:Clone()
		boomSoundClone.PlayOnRemove = true
		boomSoundClone.Parent = Rocket

		-- Attach creator tags to the rocket early on
		local creatorTag = Instance.new('ObjectValue', Rocket)
		creatorTag.Value = MyPlayer
		creatorTag.Name = 'creator' --NOTE: Must be called 'creator' for website stats
		local iconTag = Instance.new('StringValue', creatorTag)
		iconTag.Value = Tool.TextureId
		iconTag.Name = 'icon'

		-- Finally, clone the rocket script and enable it
		local rocketScriptClone = RocketScript:Clone()
		rocketScriptClone.Parent = Rocket
		rocketScriptClone.Disabled = false
	end


	local function OnActivated()
		local myModel = MyPlayer.Character
		if Tool.Enabled and myModel and myModel:FindFirstChildOfClass("Humanoid") and myModel.Humanoid.Health > 0 then
			Tool.Enabled = false
			local Pos = MouseLoc:InvokeClient(MyPlayer)
			
			local rocketClone = Rocket:Clone()
			DebrisService:AddItem(rocketClone, 30)
			rocketClone.BrickColor = BrickColor.Black()

			-- Position the rocket clone and launch!
			local spawnPosition = (ToolHandle.CFrame * CFrame.new(5, 0, 0)).p
			rocketClone.CFrame = CFrame.new(spawnPosition) --I CHANGED IT TO ONLY SPAWN POSITION, THIS WAS SPAWNPOSITION + POS,
			rocketClone.Velocity = Pos * ROCKET_SPEED --NOTE: This should be done before assigning Parent
			rocketClone.Parent = workspace
			rocketClone:SetNetworkOwner(nil)

			wait(RELOAD_TIME)

			Tool.Enabled = true
		end
	end

	function OnEquipped()
		MyPlayer = PlayersService:GetPlayerFromCharacter(Tool.Parent)
	end


	Tool.Equipped:Connect(OnEquipped)
	Tool.Activated:Connect(OnActivated)

yep that is what the script should look like!