I am currently making a game but for a part of a game, I want to make a puzzle by activating a button to make a bridge appear.

-- variables
local sound = script.Parent.Sound
local bridge = script.Parent.Parent.Bridge
local CD = script.Parent.ClickDetector
local sound2 = script.Parent.Sound2
-- code
local function onClicked()
	script.Parent.BrickColor = BrickColor.Green()
	sound:Play()
	print('script working bruh')
	wait(0.14)
	if bridge.Transparency == 0.4 then
		bridge.Transparency = 0
	if bridge.CanCollide == false then
		bridge.Cancollide = true
	if bridge.Changed then
		sound2:Play()
			end
		end
	end
end

CD.MouseClick:connect(onClicked)

I have the output window opened and the print message appears but when I wait for the script to continue, nothing happens.