I made a script that fires a bindable event whenever I shoot:
local Blaster = script.Parent
local BlasterShot = Blaster:WaitForChild("Sound")
local Player = game.Players:GetPlayerFromCharacter(Blaster.AncestryChanged:Wait().Parent)
local Mouse = Player:GetMouse()
Mouse.Icon = "rbxassetid://6725953862"
local ReplicatedStorage = game.ReplicatedStorage
local Event = ReplicatedStorage.FiringEvent
local Shooting = false
Blaster.Equipped:Connect(function()
Mouse.Button1Down:Connect(function()
Shooting = true
while Shooting do
Event:Fire(Blaster.Handle.Position, Blaster.Handle.Orientation, Mouse.Hit.p)
BlasterShot:Play()
Mouse.Button1Up:Connect(function()
Shooting = false
end)
wait(.01)
end
end)
end)
It gives me an error: Players.sidb0102.Backpack.A-280.GunScript:4: attempt to index nil with 'GetMouse' I don't understand. I thought it would fire when I equipped it, Right?

3 comments
When I would make a gun, I just used the FastCast module it's simple and causes no lag. Here's a tutorial https://www.youtube.com/watch?v=mJZWY3G7wa4
I need an automatic one.
https://www.youtube.com/watch?v=YyQi82TzYL4