I want to attach a little gun to my car. I want to make the gun fire a part in whichever direction it is facing.
I have NO idea on how to do this. I only know how to make it so that it fires in the same direction by giving it a set velocity, but the car will be moving, so if I set the velocity to 0,100,0. The gun will only fire towards the direction of Y.
Please help
shooter = script.Parent
button = game.Workspace.Button
function firePart()
local p = Instance.new("Part" , workspace)
p.Size = 1,1,1
p.Parent = workspace
p.Anchored = false
p.Velocity = --?
end
button.ClickDetector.MouseButton1Click:connect(firePart)

2 comments
It doesn't work :(, I also tried putting it in a local script but that didn't work either.
Check the explorer to see if the part has spawned. I'm sure it has, the issue is that you didn't CFrame it so that it spawns in front of the character..