No script errors printed. The auto gun is supposed to shoot a something with Humanoid if it gets within 100 studs.

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Bullet = ReplicatedStorage:WaitForChild("Bullet")


local turrent = script.Parent
local Firerate = 0.2
local BulletDamage = 1
local BulletSpeed = 200
local AggroDistance = 100
local target 
while wait(Firerate)do
	local target = nil
	for i, v in pairs (game.Workspace:GetChildren()) do
		local humanoid = v:FindFirstChild("Humanoid")
		local UpperTorso = v:FindFirstChild("UpperTorso")
		if humanoid and UpperTorso and humanoid.Health > 0 then
			if (UpperTorso.Position - turrent.Position).magnitude < AggroDistance then
				humanoid = target
			end
		end
	end
end

if target then
	local humanoid = target
	turrent.CFrame = CFrame.new(turrent.Position, humanoid.Position)
	local BulletClone = Bullet:Clone()
	Bullet.Position = turrent.Position
	Bullet.Parent = game.Workspace
	Bullet.Velocity = turrent.CFrame.LookVector*BulletSpeed
	BulletClone.Touched:Connect(function(ThingHit)
		local humanoid = ThingHit.Parent:FindFirstChild("Humanoid")
		if humanoid then
			humanoid:TakeDamage(BulletDamage)
		end
	end)
end