Upgrade system prints one line but not the others? [INTERNET ERROR, IGNORE]

local buyButton = script.Parent 
local clickDetector = script.Parent.ClickDetector

local newSpaces = 10
local upgradeCost = 100

local function giveUpgrade(player)
	print("Someone clicked the button")
	local playerStats = player:FindFirstChild("leaderstats")
	local playerGold = playerStats:FindFirstChild("Gold")
	local playerSpaces = playerStats:FindFirstChild("Spaces")
	if playerGold.Value >= upgradeCost then
		print("Player can buy item")
		playerGold.Value = playerGold.Value - upgradeCost
		print("Money deducted")
		playerSpaces.Value = newSpaces
		print("Bp given")
	end
end

clickDetector.MouseClick:Connect(giveUpgrade)

It only prints “Player can buy item” but nothing else. This is located within a part that is located in the workspace. What did I do wrong and how can I improve this script so I know next time?

is there anything in the output?

Nope, just the print message, no errors, nothing.

I just tested this script and made a leaderboard. Everything works fine for me.

Sorry, this has nothing to do scripts committing. I have no idea why yours isn’t working, it looks fine.