Title. I have been trying to script a mortar, and it actually works fine, until you move its height up or down. This has been bugging me because when I will actually use the mortar you could move it up or down.
local mag = ((script.Parent.PrimaryPart.Position-target.Position)-Vector3.new(script.Parent.PrimaryPart.Position.Y,0,script.Parent.PrimaryPart.Position.Y)).magnitude --shell.vel.Velocity = script.Parent.PrimaryPart.CFrame.lookVector*32.5+Vector3.new(0,50,0) shell.vel.Velocity = (script.Parent.PrimaryPart.CFrame.lookVector*mag+Vector3.new(0,50,0)) shell.Touched:Connect(function(hit) if hit.Parent ~= script.Parent then shell:Destroy() end end) game:GetService("Debris"):AddItem(shell,3) --wait(.25) --if shell ~= nil and shell:FindFirstChild("vel") ~= nil then shell.vel:Destroy() end for i = 1,20 do shell.vel.Velocity = shell.vel.Velocity + Vector3.new(0,-2.5,0) wait() end for i = 1,10 do shell.vel.Velocity = shell.vel.Velocity + Vector3.new(0,-5,0) wait() end
(This is a shortened version of the script, most of it is just creating the shell)
I'm not sure how I could calculate a height mechanism to change how high and fast it will go.