I have a cannon object on the front of the cannon that the cannon ball which its referencing going to the position of the cannon shoot. I need to mix the Orientation and the Position to make the cannon ball go in a certain direction.
Code here.
local direction = script.Parent.CannonShoot.Orientation local clickdetector = script.Parent:WaitForChild("ClickDetector") clickdetector.MouseClick:Connect(function() local copy = game.Workspace.Part:Clone() copy.Parent = workspace copy.Position = script.Parent.CannonShoot.Position copy.Orientation = script.Parent.CannonShoot.Orientation copy.Anchored = true while true do copy.Position = copy.Position + Vector3.new () --i need help here because i need to mix the orientation and the position wait(0.01) end end)
local clickdetector = script.Parent:WaitForChild("ClickDetector") clickdetector.MouseClick:Connect(function() local copy = game.Workspace.Part:Clone() copy.Parent = workspace copy.Position = script.Parent.CannonShoot.Position copy.Anchored = true while true do wait(0.01) copy.CFrame = copy.CFrame + CFrame.Angles(90,0,0)-- set to how much you want to rotate copy.Position = copy.Position + Vector3.new(0,0,0)-- set to whatever position end end)
This should work.
Up vote and accept if this helped!
All the best,
PrismaticFruits