partstore = game.ServerStorage.CannonBall
workspace.Launch.CanCollide = false
pressed = false
turningangle = workspace.Launch.Orientation
function shoot()
if pressed == false then
local storepart = partstore:Clone()
storepart.Parent = workspace
storepart.Position = workspace.Launch.Position
storepart.Orientation = workspace.Launch.Orientation
storepart.Velocity = Vector3.new(-200,0,0)
pressed = true
wait(5)
workspace.CannonBall:Destroy()
pressed = false
end
end
game.Workspace.Launch.ClickDetector.MouseClick:connect(shoot)
I know the script is really messy right now but I'm planning to tidy it once the basic functionality is sorted.
I'm trying to get the storepart.velocity to shoot in the direction the cannon is pointed at around 200 studs, I know how to get it to shoot at a specific angle, but I don't know how to get it to shoot in the constantly changing rotational direction of the cannon.
2 comments
Use the code block, scroll over the lua sign in edit. Next to where all the options are like italics etc
Thanks, I thought that might have been it but when it just came up with a bunch of tildas I decided to just leave it as is. :P