Variable trying to find a boolean when assigned an object from a parameter

I’m making a tower defense game and 2 weeks ago I made a function for making a visual range circle, I didn’t touch it a single time and I don’t know why but now it’s giving me 3 errors in the same script.

Now it won’t let me upgrade the selected tower (when I press the “Upgrade” button, the selected tower gets replaced by an upgraded version of it using an ObjectValue).

The errors that appear in the output are the following:

This is line 92:

local range = tower.Config.Range.Value

“tower” is a parameter on the function local function createRangeCircle(tower, placeholder), “Config” is a folder that’s inside “tower” and “Range” is a NumberValue.

This is line 228:

createRangeCircle(selectedTower, false)

“selectedTower” is the tower that you clicked on (when you click on a tower, the range circle appears) and “false” is reffering to if the tower is a placeholder or not.

This is line 308:

toggleTowerInfo()

That function can’t be fired because of the line 228 error.

This is the entire createRangeCircle function:

local function createRangeCircle(tower, placeholder)

	local range = tower.Config.Range.Value
	local height = (tower.PrimaryPart.Size.Y / 2) + tower.Humanoid.HipHeight
	local offset = CFrame.new(0, -height, 0)

	local radius = Instance.new("Part")
	radius.Name = "Range"
	radius.Shape = Enum.PartType.Cylinder
	radius.Material = Enum.Material.Neon
	radius.Transparency = 0.8
	radius.Size = Vector3.new(2, range * 2, range * 2)
	radius.TopSurface = Enum.SurfaceType.Smooth
	radius.BottomSurface = Enum.SurfaceType.Smooth
	radius.CFrame = tower.PrimaryPart.CFrame * offset * CFrame.Angles(0, 0, math.rad(90))
	radius.CanCollide = false

	local phRadius = Instance.new("Part")
	phRadius.Name = "PhRange"
	phRadius.Shape = Enum.PartType.Cylinder
	phRadius.Material = Enum.Material.Neon
	phRadius.Transparency = 0.8
	phRadius.Size = Vector3.new(2, range * 2, range * 2)
	phRadius.TopSurface = Enum.SurfaceType.Smooth
	phRadius.BottomSurface = Enum.SurfaceType.Smooth
	phRadius.CFrame = tower.PrimaryPart.CFrame *  offset * CFrame.Angles(0, 0, math.rad(90))
	radius.CanCollide = false

	if placeholder then
		
		workspace.Camera:ClearAllChildren()
		phRadius.Anchored = false

		local weld = Instance.new("WeldConstraint")
		weld.Part0 = phRadius
		weld.Part1 = tower.PrimaryPart
		weld.Parent = phRadius
		phRadius.Parent = tower

	else

		radius.Anchored = true
		radius.Parent = workspace.Camera

	end
end

If someone needs to see more lines of code, feel free to tell me and I’ll show them to you.