I want to launch a projectile from the player to the the position of their mouse. However, the projectile is not properly launching as it seems like the force is never actually applied to the projectile.
This projectile is the child of the workspace and the weld shown is connecting the projectile to the players arm, this weld is also the child of the workspace
local duration = 0.5
if fireball ~= nil then
weld:Destroy()
print(mousepos.Position)
local force = Vector3.new(0,0,0) - fireball.Position
print(force)
force = force / duration + Vector3.new(0,duration * workspace.Gravity*0.5 ,0)
print(fireball.AssemblyMass)
fireball:ApplyImpulse(force * fireball.AssemblyMass)
fireball.Touched:Connect(function(part)
if part:IsDescendantOf(character) == false then
fireball:Destroy()
end
end)
end
Here are the output of values from the prints, it seems like these are appropriate given what they should be but the Impulse is never actually applied. The fireball just drops from the players arm
try something like this for your impulse to see if it works :ApplyImpulse(Vector3.new(10000,0,0))
if not then you might need to clone your fireball if its the actual one welded, parent to workspace, then try again
That seems to have worked, but I am confused on why it did work.
I cloned the fireball again when the weld is destroyed and then it seems to properly function and launch. Do you have any idea why this is? I don’t know why the original clone would not actually launch and need a secondary clone to function
well if the original clone is welded to the player it was probably holding it in place when you cloned that it gets rid of the weld allowing the part to move freely