Projectile not moving infront of the tool

I want to make a tool that if you click a projectile appears and it moves forward depending on how the tool is faced, not just one way. the problem is that this doesnt work, and i havent seen much things about this

my code

local tool = script.Parent


tool.Activated:Connect(function()
	local bullet = game.ServerStorage.bullets.bullet
	local bulletclone = bullet:Clone()
	bulletclone.Parent = workspace
	bulletclone.Position = tool.Handle.CFrame.Position - Vector3.new(0, 0, 2.5)
	tool.BulletSound:Play()
	while true do
		task.wait()
		bulletclone.CFrame.Position = bulletclone.CFrame.LookVector + 5
	end
end)
1 Like
-- Put this script inside the tool you want to move

local tool = script.Parent
local handle = tool:WaitForChild("Handle") -- Change "Handle" to the name of the part you want to use as the handle

local function onActivated()
    -- Define the movement here
    local newPosition = Vector3.new(10, 0, 0)  -- Change the coordinates as needed
    
    -- Move the tool
    tool:SetPrimaryPartCFrame(CFrame.new(newPosition))
end

tool.Activated:Connect(onActivated)

1 Like

i want a projectile that spawns when you click the item and it keeps constantly going forward

look at this video
robloxapp-20240113-1755142.wmv (1.6 MB)

i want the projectile to constantly go forward like you can see in the video, but i want to make it so it depends on where the handle is, like when i turn around it keeps going to where it goes before

I So maybe that’s about the tune that’s not moving. You’re right s’t understand you you mean like this tools

1 Like

well it didnt work for me the script that i showed you was what i did one time trying to use lookvectors and it didnt work
this is the script im using now, which i didnt add lookvectors so it goes a specific way

local tool = script.Parent

tool.Activated:Connect(function()
	local raybullet = game.ServerStorage.RayGunStuff.RayGunBullet
	local raybulletclone = raybullet:Clone()
	raybulletclone.Parent = workspace
	raybulletclone.Position = tool.Handle.CFrame.Position
	tool.ShootRay:Play()
	while true do
		task.wait()
		raybulletclone.CFrame = raybulletclone.CFrame + Vector3.new(0, 0, 1)
	end
end)

so sorry for the confusion, but adding onto this script what would i need to add

1 Like

So now I tell you that it’s working now try it out

1 Like

i used the first script i put it didnt work

1 Like