For a projectile shot from a cannon I want it shot in a certain direction using a Vector3Value inserted under the model Cannon so that for each different instance of the cannon in my world, I don't have to jump into the code and set a new (x,y,z).
Instead I wish to use a Vector3Value named "Velocity" whose direct parent is the Model "Cannon"
local storage = game.ServerStorage
while true do
local cBall = storage.cannonBall:Clone()
cBall.Parent = game.Workspace
cBall.CFrame = CFrame.new(game.Workspace.Cannon.Barrel.Position)
cBall.Velocity = Vector3.new(50,0,0)
wait(2)
end
This is the current code with the Vector3.new value there as a filler. How would I declare the Vector3Value as a variable so that the XYZ value that can be set in Explorer is used for the XYZ where the (50,0,0) is in the code
https://gyazo.com/3a6a04a25899ecb7b5695f0076eadb49 Here is a screenshot of the hierarchy I'm using with the "Shoot" script being the one I put in the code block.
Thank you for any help given!
~MBacon15

2 comments
The code didn't end up spawning anything in, let alone apply a velocity to it. Even when I modified my code to have the velocity variable, nothing happened. I'll look back at this when I return home later.
Note where the Vector value is. I just used script.Parent as an example, if you have it held somewhere else, use WaitForChild on that parent instead.