Button not working when changing Camera CFrame

Hey, for some reason when I click a button it doesn’t seem to work, there’s no error and it doesn’t even print a message once clicked. I’m not sure if it’s because of my moving Camera CFrame but I’m losing my mind.

local TweenService = game:GetService("TweenService")
local looping = true
local CameraScenes = workspace.CameraScenes
local Camera = workspace.Camera

repeat wait() until Camera.CameraSubject ~= nil


while looping do
	for i, v in pairs(CameraScenes:GetChildren()) do
		if looping == false then
			Camera.CameraType = Enum.CameraType.Custom
			return end
		Camera.CameraType = Enum.CameraType.Scriptable
		Camera.CFrame = v["1"].CFrame
		currentTween = TweenService:Create(Camera, TweenInfo.new(10), {CFrame = v["2"].CFrame})
		currentTween:Play()
		wait(10)
	end
end

script.Parent.PlayButtonEdit.Button.MouseButton1Click:Connect(function()
	print("test")
end)

https://gyazo.com/0a4eaebda4ae4bc21607dab54194bf74
^ The video if it not working

Is it perhaps a ZIndex issue: is there any element above the button which might block the click?

Any functions written below a loop won’t call until said loop breaks. Try putting the function before your while loop.

thanks it worked, finally I can not go insane.