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)
-- 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)
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
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