I am trying to make it fire a projectile with this script
local player = game.Players.LocalPlayer local tool = script.Parent local Char = player.Character
function GetBullet() local Bullet = Instance.new("Part",workspace) Bullet.FormFactor = "Custom" Bullet.Size = Vector3.new(1,1,1) Bullet.BrickColor = BrickColor.new("Purple") Bullet.CanCollide = false Instance.new("BodyVelocity",Bullet) return Bullet
end
tool.Equipped:Connect(function(mouse)
mouse.Button1Down:connect(function()
local mH = mouse.hit
local Bullet = GetBullet()
Bullet.CFrame = tool.Handle.CFrame * CFrame.new(Char.UpperTorso.CFrame.lookVector * 2)
Bullet.CFrame = CFrame.new(Bullet.Position, mH.Bullet)
Bullet.BodyVelocity.velocity = Bullet.CFrame.lookVector * 120 --Speed Of Bullet
Bullet.Touched:connect(function(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid then
humanoid:TakeDamage(50)
end
end)
end)
end)
It says "Bullet is not a valid Member of CFrame"