Attempting to script a event, currently does not work

Hello. I was attempting to make a easter event for my game until I tried to script it. It failed (like most of my scripts lol) when I tested it.

Also I want the gift collecting part to run on a LocalScript and the badge part on a ServerScript.

script:

local BadgeID = imnottellingyou
local GiftHandlers = {"Handle1", "Handle2", "Handle3", "Handle4", "Handle5"}

local IsAllTransparent = true
local function CheckGifts(plr)
	for i, Gifts in ipairs(script.Parent:GetChildren()) do
		if table.find(GiftHandlers, Gifts.Name) and Gifts.Transparency == 0 then
			IsAllTransparent = false
		end
	end
	
	if IsAllTransparent == true then
		
		local b = game:GetService("BadgeService")
		if b:UserHasBadgeAsync(plr, BadgeID) == false then
			b:AwardBadge(plr.userId, BadgeID)
		
		end
		
	end
	wait(0.1)
	IsAllTransparent = true
end




for i, Gifts in ipairs(script.Parent:GetChildren()) do
	if table.find(GiftHandlers, Gifts.Name) then
		Gifts:FindFirstChild("ClickDetector").MouseClick:Connect(function(plr)
			Gifts.Transparency = 1
			Gifts.CanCollide = false
			CheckGifts(plr)
		end)
	end
end