I'm making a shotgun, and when I shoot, the bullets raycast only appears when I shoot it at the ground, and not the sky. Help!
function Fire() for i = 10,0,-1 do local ray = Ray.new(Tool.Handle.CFrame.p, (Mouse.Hit.p - Tool.Handle.CFrame.p + Vector3.new(math.random(-2,2), math.random(-2,2), 0)) * 1000) local part, position = workspace:FindPartOnRay(ray, Player.Character, false, true) local beam = Instance.new("Part", workspace) beam.BrickColor = BrickColor.new("Electric blue") beam.FormFactor = "Custom" beam.Material = "Neon" beam.Transparency = 0.5 beam.Anchored = true beam.Locked = true beam.CanCollide = false local distance = (Tool.Handle.CFrame.p - position).magnitude beam.Size = Vector3.new(0.3, 0.3, distance) beam.CFrame = CFrame.new(Tool.Handle.CFrame.p, position) * CFrame.new(0, 0, -distance / 2) game:GetService("Debris"):AddItem(beam, 0.1) Tool.Fire:Play() if part then local humanoid = part.Parent:FindFirstChild("Humanoid") if not humanoid then humanoid = part.Parent.Parent:FindFirstChild("Humanoid") end if humanoid then humanoid:TakeDamage(10) if humanoid.Health == 0 then Player.leaderstats.Eliminations.Value = Player.leaderstats.Eliminations.Value + 1 KilledPerson.Value = humanoid.Parent.Name Player.PlayerGui.KillCounter.TextLabel.Text = "You killed "..KilledPerson.Value.."!" wait(3) Player.PlayerGui.KillCounter.TextLabel.Text = "" end end end end end