I was hoping that the script is for being convenient to update without editing it. But I hit a problem.
Well, here's the whole script. Read the green sentences inside
local buttons = script.Parent local maxpage = math.ceil(#game.ReplicatedStorage.Morphs:GetChildren()/10) local pagetag = buttons.Pages local zero = buttons["0"] local one = buttons["1"] local two = buttons["2"] local three = buttons["3"] local four = buttons["4"] local five = buttons["5"] local six = buttons["6"] local seven = buttons["7"] local eight = buttons["8"] local nine = buttons["9"] function Page_Flipped(Value) --this is where the problem is function Change_Text(button,text) --I wish to fix the problem right in this function but if text ~= nil then -----------------------find a way button.Text = text elseif text == nil then button.Text = "--" end end morphs = game.ReplicatedStorage.Morphs:GetChildren() pagetag.Text = Value.."/"..maxpage Change_Text(zero,morphs[1 + 10*(Value-1)].Name)--it stucks right in these Change_Text(one,morphs[2 + 10*(Value-1)].Name)--when it hits a nil value, the whole thing Change_Text(two,morphs[3 + 10*(Value-1)].Name)--stucks Change_Text(three,morphs[4 + 10*(Value-1)].Name) Change_Text(four,morphs[5 + 10*(Value-1)].Name) Change_Text(five,morphs[6 + 10*(Value-1)].Name) Change_Text(six,morphs[7 + 10*(Value-1)].Name) Change_Text(seven,morphs[8 + 10*(Value-1)].Name) Change_Text(eight,morphs[9 + 10*(Value-1)].Name) Change_Text(nine,morphs[10 + 10*(Value-1)].Name) end function PlayerAdded()--flip the race menu to 1 when player joined--never mind the rest script.Parent.Page.Value = 1 end for i,v in pairs(buttons:GetChildren()) do --All the buttons if v.ClassName == "TextButton" then v.MouseButton1Click:connect(function() if v.Name == "Next" then if script.Parent.Page.Value == maxpage then script.Parent.Page.Value = 1 else script.Parent.Page.Value = script.Parent.Page.Value + 1 end elseif v.Name == "Previous" then if script.Parent.Page.Value == 1 then script.Parent.Page.Value = maxpage else script.Parent.Page.Value = script.Parent.Page.Value - 1 end elseif v.Name ~= "Next" and v.Name ~= "Previous" and v.Name ~= "--" then script.Parent.Parent.Class.Visible = true script.Parent.Parent.Class.Genre.Value = v.Text script.Parent.Visible = false end end) end end script.Parent.Page.Changed:connect(Page_Flipped) game.Players.PlayerAdded:connect(PlayerAdded) for _, player in pairs(game.Players:GetPlayers()) do PlayerAdded(player) end