I am trying to make a main menu with a training tab. If your rank is '1' then you will go to the LR training tab and if your rank is '2' you go to the MR tab, '3' to HR and so on.
COMMUNITY QUESTION
How do I make a GUI tween to a certain frame depending on a group rank?
1 answer
https://developer.roblox.com/en-us/api-reference/function/Player/GetRankInGroup https://developer.roblox.com/en-us/api-reference/class/UIPageLayout
Using these two pages we can determine that you can get the group rank of a player by doing Player:GetRankInGroup(groupid) We can also determine that you can use UiPageLayouts to create a "book" and then call :JumpTo(Page) on the UiPageLayout to go to a specific page. Keep in mind that you need to define Page as the physical frame that you want to go to, not a number.
local TextButton = game.Players.LocalPlayer.PlayerGui.ScreenGui.ExampleTextButtonLocation
local UiPage = game.Players.LocalPlayer.PlayerGui.ScreenGui.Pages.UiPageLayout
local page1 = game.Players.LocalPlayer.PlayerGui.ScreenGui.Pages.Page1
local page2 = game.Players.LocalPlayer.PlayerGui.ScreenGui.Pages.Page2
local player = game.Players.LocalPlayer
TextButton.MouseButton1Down:Connect(function()
if player:GetRankInGroup(GROUPID) == 1 then
UiPage:JumpTo(Page1) -- Remember Page1 is defined as the physical gui frame itself, so like screengui.Pages.Page1.
elseif player:GetRankInGroup(GROUPID) == 2 then
UiPage:JumpTo(Page2)
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
