UIPageLayout.PageEnter and UIPageLayout.PageLeave

,

You can write your topic however you want, but you need to answer these questions:

  1. What do I want to achieve?
    I want to make the button change color when the page finishes moving.

  2. What is the issue?
    For some reason, the event doesn’t work.

This code is written in local script.

local UIPageLayout = script.Parent.Parent.ScreenBack.UIPageLayout

UIPageLayout.PageEnter:Connect(function(page)
	local currentButton = script.Parent:FindFirstChild(page.Name)

	if currentButton then
		currentButton.BackGroundColor = Color3.fromRGB(99,99,99)
	end
end)

UIPageLayout.PageLeave:Connect(function(page)
	local currentButton = script.Parent:FindFirstChild(page.Name)

	if currentButton then
		currentButton.BackGroundColor = Color3.fromRGB(243, 243, 243)
	end
end)

P. S.
I debugged the code, the event just doesn’t work, it’s not about checking.

1 Like

What does the AbsoluteSize property of the “UIPageLayout” instance show?

2022-01-17_01-05-18

1 Like