I made a tool that fires a projectile and it fire to the side
local cooldown = false
script.RemoteEvent.OnServerEvent:Connect(function(plr, mouse)
local player = plr
local mH = mouse
local function GetBullet()
local p = Instance.new("Part", workspace)
p.FormFactor = "Custom"
p.Size = Vector3.new(.5, .5, 2)
p.BrickColor = BrickColor.Red()
p.CanCollide = false
Instance.new("BodyVelocity", p)
local s = Instance.new("Sparkles", p)
s.SparkleColor = Color3.new(255,0,0)
return p
end
if not cooldown then
cooldown = true
--Fire Projectile--
local dino = game.Workspace:FindFirstChild(player.Name):FindFirstChild("Robo Dino")
local bullet = GetBullet()
bullet.CFrame = dino.TailBarrel.CFrame * CFrame.new(dino.TailBarrel.CFrame.lookVector * 0)
bullet.CFrame = CFrame.new(bullet.Position, mH.p)
bullet.BodyVelocity.velocity = bullet.CFrame.lookVector * 120
wait(.1)
bullet.Touched:Connect(function(hit)
print(hit.Name)
local kill = hit:IsDescendantOf(game.Workspace:FindFirstChild(player.Name))
if not kill then
print(hit:GetFullName())
bullet:Destroy()
end
for _, child in pairs(hit.Parent:GetChildren())
do
if child:IsA("Humanoid") and child.Parent.Name ~= player.Name then
child:TakeDamage(100)
end
end
end)
print("On Cooldown...")
wait(script.Parent.Parent.Cooldown.Value)
cooldown = false
print("Ready!")
end
end)
Im firing it from the dino's tail named "TailBarrel"

2 comments
Indentation is there to make it easier to read, why would you bother removing it?
The error is most likely "mH.p" on line 45. I don't know what exactly mH is because it is the argument of the function, so if mH is not mouse.Hit, then change "mH.p" to "mH.Hit.p".