Help with auto gun

Hello so for some reason my gun does not want to shoot an automatic bullet and I don’t know why so if any of you could help it could be cool!

The code:

mouse.Button1Down:Connect(function()
	if eq == true then
		local Target1 = mouse.Target
		if script.Parent.Parent == plr.Character and cooldown == false then
			script.Parent.PlaySound:FireServer()
			if Target1 == nil then

				
				print('No Model')
				cooldown = true
				script.Parent.ShootEvent:FireServer()

				wait(FireRate)
				cooldown = false

			elseif Target1.Parent.Parent.ClassName == 'Model' then
				local Event = Target1.Parent.Parent:WaitForChild('Damage')
				Event:FireServer(Damage)
				cooldown = true
				script.Parent.ShootEvent:FireServer()
				print(Target1:GetFullName())

				if Target1.Parent.Parent:WaitForChild('Humanoid') then
					HitSound:Play()
				end


				wait(FireRate)
				cooldown = false

			elseif Target1.Parent.ClassName == 'Model' then
				local Event = Target1.Parent:WaitForChild('Damage')
				Event:FireServer(Damage)
				cooldown = true
				script.Parent.ShootEvent:FireServer()
				print(Target1:GetFullName())
				if Target1.Parent:WaitForChild('Humanoid') then
					HitSound:Play()
				end

				wait(FireRate)
				cooldown = false

				


			else
				print('No Model')
				cooldown = true
				script.Parent.ShootEvent:FireServer()

				wait(FireRate)
				cooldown = false

			end
		end

	end
	
end)
1 Like

You need to use :

While true do
     wait()
     ---- put your code here ----
end

oh yeah am dumb i forgot to put that lol

1 Like