the gun script has magnitude < 1.33 in it and it makes it so that when you shoot behind you, the gun doesnt shoot. i added a debounce to the gun script and it works until you shoot behind or to the side of your character it stops shooting and it doesnt let you shoot forward again. it used to let you shoot forward again without debounce. i wanna keep the debounce so the gun can have a cooldown so it isnt spam fired. you have to re-equip the gun for it to shoot again, but it still breaks if you shoot to the side or behind your character.
Here is some of the script that is probably breaking the gun.
tool.Equipped:Connect(function(mouse)
gungui:Clone().Parent = player.PlayerGui
findBodyType()
equipAnimation:FireServer(tool.ShootAnim)
mouse.Icon = "rbxassetid://7262331135"
local debounce = false
mouse.Button1Down:Connect(function()
if bullets.Value <= 0 or reloading == true then
else
if not debounce then
debounce = true
local head = game.Workspace[player.Name].Head.CFrame.lookVector
local mouse = CFrame.new(game.Workspace[player.Name].Head.Position,mouse.Hit.p).lookVector
difference = (head-mouse)
local ray = Ray.new(tool.Handle.CFrame.p,(player:GetMouse().Hit.p - tool.Handle.CFrame.p).unit*300)
local part,position = game.workspace:FindPartOnRay(ray,player.Character,false,true)
if difference.magnitude < 1.33 then
gunshotSound:Play()
shootevent:FireServer(tool,position,part)
bullets.Value = bullets.Value - 1
wait(1)
debounce = false
end
end
end
end)

3 comments
That happens because you do not reset the debounce. A debounce should not be used to do what you wish, either. A simple conditional will do
FYI, each time you equip your gun you will multiply your Button1Down response—3 equips will shoot your gun 3 times, etc... You can resolve this by just using Tool.Activated
workspace:Raycast has also superseded this method of ray-casting.