So I was following a basic tutorial on how to make projectiles since I wanted to get into more complex math stuff. The entire tutorial was very clear and made it easy to understand but I was left puzzled when my script was behaving weirdly to what was happening on the tutorial. I don’t know if it was because the tutorial was already a bit over 2 years old, or it was just me doing something wrong without me noticing. From what I’ve noticed, it seems like the Vector3.new at the end of the force formula is causing something to happen, because It works normal before I add it, but I’m not sure since I even followed the tutorial completely to see if something was wrong. I am severely lacking sleep
Script located within ServerScriptService:
while true do
task.wait(5)
local startPos = workspace.Start.Position
local endPos = workspace.End.Position
local direction = endPos - startPos
local duration = math.log(1.001 * direction.Magnitude * 1.001)
local force = direction / duration * Vector3.new(0, game.Workspace.Gravity / 2, 0)
local projectile = game.ServerStorage.Projectile:Clone()
projectile.Parent = workspace ; projectile.Position = startPos
projectile:ApplyImpulse(force * projectile.AssemblyMass)
game.Debris:AddItem(projectile, 5)
end
This is the tutorial if you’re wondering: