I need to identify when someone clicks the join button, to join their friend, on the roblox main website or games menu on mobile.
I currently have hub server, to select game types and invite party members.
Then the player is moved to a private game server to play.
player.FollowUserId
Is nil when a friend is in the game server, and the player joining gets forwarded to the public hub server.
local function onPlayerAdded(player)
wait(5)
-- attempting to grab the follow user id
local FollowedUserId = player.FollowUserId
if player.FollowUserId ~= 0 and player.FollowUserId ~= nil then
-- grabbing the player from the follow user id
local FollowedToJoin = Players:GetPlayerByUserId(FollowedUserId)
-- grabbing the player info in the current Games
local PlayerInfo = MatchmakingService:GetPlayerInfo(FollowedToJoin)
-- grabbing the freinds game id
local PlayerToJoinsGame = MatchmakingService:GetRunningGame(PlayerInfo.code)
SendChatMessageEvent:FireClient(player, "Found "..FollowedToJoin.Name.."'s Game")
if PlayerToJoinsGame["joinable"] == false then
SendChatMessageEvent:FireClient(FollowedToJoin.Name.."'s Game is Full!")
end
if PlayerToJoinsGame["joinable"] == true then
-- attempting to join the game server
SendChatMessageEvent:FireClient(player, "Joining "..FollowedToJoin.Name.."'s Game!")
local PlayerGui = player:WaitForChild("PlayerGui")
local Loading = PlayerGui:WaitForChild("Loading")
Loading.Enabled = true
MatchmakingService:QueuePlayer(player, "Casual", "FreeforAll")
wait(3)
Loading.Cancel.Visible = false
end
end
end
I was thinking that I could just make an invite screen from the game server, but I really donβt wanna break the Roblox official Join Friend Button. I need to get them to move through the hub server to smoothly join their friend in the game server.