Hello, so I really would like to know how I can get the current page of a ui page layout. I tried using .CurrentPage but that returns an instance. Not number. Can someone please help me? This is my script:
local Button = script.Parent
local UiPageLayout = Button.Parent.InventoryFrame.UIPageLayout
local function GetCurrentAmountOfPages()
local Amount = 0
for i,v in pairs(UiPageLayout.Parent:GetChildren()) do
if v:IsA("Frame") then
Amount +=1
end
end
return Amount
end
UiPageLayout.Changed:Connect(function()
print(UiPageLayout. GetCurrentAmountOfPages())
if UiPageLayout.CurrentPage == GetCurrentAmountOfPages() then
script.Parent.Visible = false
else
script.Parent.Visible = true
end
end)
Button.MouseButton1Click:Connect(function()
UiPageLayout:Next()
end)