The error is on line 23 and it says: Scripts.LocalScript:23: attempt to index local ‘mouse’ (a nil value).
local muzzle = tool.Muzzle local handle = tool.Handle local debounce = true local config = tool.Config local range = config.Range local dmg = config.Damage local coolDown = config.CoolDown local clips = config.Clips local ammo = config.Ammo local maxAmmo = config.MaxAmmo local allowTracing = config.AllowTracing
--//Events tool.Equipped:Connect(function() tool.Activated:Connect(function(mouse) if debounce then --//Doesn't allow spamming debounce = false --//Ray Get, Set local ray = Ray.new(muzzle.CFrame.p, (mouse.Hit.p - muzzle.CFrame.p) * range.Value) local hit, position = workspace:FindPartOnRay(ray, plr.Character, false, true)
if allowTracing.Value == true then --//Make part local trace = Instance.new("Part", workspace) trace.Material = Enum.Material.Neon trace.BrickColor = BrickColor.new("Black") trace.CanCollide = false trace.Anchored = true trace.Transparency = 0.5 --//Show Direction local distance = (muzzle.CFrame.p - position).magnitude trace.Size = Vector3.new(0.2, 0.2, distance) trace.CFrame = CFrame.new(muzzle.CFrame.p, position) * CFrame.new(0, 0, -distance/2)