I am very new to scripting so I'm sorry if this scripts untidiness makes you cringe.
local tool = script.Parent
local player = tool.Parent.Parent
local mouse = player:GetMouse()
local root = player.Character.HumanoidRootPart
tool.RemoteEvent.OnServerEvent:connect(function(player,mousehit)
if player.Character:FindFirstChild("multiattackprevention") then return end
local multiattackprevention = Instance.new("StringValue")
multiattackprevention.Parent = player.Character
multiattackprevention.Name = ("multiattackprevention")
local hitcooldown = false
local animation = player.Character.Humanoid:LoadAnimation(player.Character:FindFirstChild("SuperJump"))
animation:Play()
wait(0.5)
local bv = Instance.new("BodyVelocity")
bv.Parent = player.Character.Torso
bv.Velocity = Vector3.new(0,200,0)
wait(0.7)
bv:Destroy()
root.CFrame = mouse.Origin
player.Character.Head.Anchored = true
local animation = player.Character.Humanoid:LoadAnimation(tool.Cast)
animation:Play()
wait(0.4)
local projectile = Instance.new("Part")
projectile.Transparency = 1
projectile.Parent = game.Workspace
projectile.Position = player.Character:FindFirstChild("Right Arm").Position
projectile.CanCollide = false
projectile.TopSurface = ("Smooth")
projectile.BottomSurface = ("Smooth")
projectile.Size = Vector3.new(10,10,10)
local fireparticle = Instance.new("Fire")
fireparticle.Parent = projectile
fireparticle.Size = 20
fireparticle.Heat = 25
local bv = Instance.new("BodyVelocity")
bv.Parent = projectile
bv.MaxForce = Vector3.new(1e8,1e8,1e8)
bv.Velocity = root.CFrame.p * 150
local sound = Instance.new("Sound")
wait(0.2)
multiattackprevention:Destroy()
projectile.CanCollide = true
player.Character.Head.Anchored = false
projectile.Touched:connect(function(hit)
projectile.Anchored = true
fireparticle.Size = 30
bv.Velocity = mousehit.lookVector * 0
if hitcooldown == true then return end
local enemy = hit.Parent:FindFirstChild("Humanoid")
if enemy == player.Character.Humanoid then return end
if enemy then
enemy.Health = enemy.Health - 250
hitcooldown = true
wait(1)
projectile:Destroy()
else wait(1)
projectile:Destroy()
wait(3)
end
end)
wait(10)
projectile:Destroy()
multiattackprevention:Destroy()
end)
This works with no output error, however the projectile doesn't spawn.
The error is to do with:
bv.Velocity = root.CFrame.p * 150
I know this because when I put:
bv.Velocity = mousehit.lookVector * 150
the projectile fires, just in the wrong direction.
What should I make bv.Velocity equal to?

2 comments
use raycasting!1!! stop using terrible roblox physics!!1
bv.Velocity = (root.Position - mousehit.p).unit * 150. Normalise the two vectors then multiply by an arbitrary speed (in this case 150)