Hey Developers
So for a couple hours now I’ve been trying to figure out, how to make a invite gui on a top bar button, please tell me why this doesn’t work.
local replicatedStorage = game:GetService("ReplicatedStorage")
local topbarPlus = replicatedStorage:WaitForChild("HDAdmin"):WaitForChild("Topbar+")
local iconController = require(topbarPlus.IconController)
local gui = Instance.new("ScreenGui")
local shopIcon = iconController:createIcon("Shop", 4882429582, 1)
shopIcon:setToggleMenu(gui.Shop) -- Set the shop menu to be toggled by the icon
shopIcon:notify() -- Prompt a notification
local button = shopIcon
local SocialService = game:GetService("SocialService")
local player = game.Players.LocalPlayer
function onButtonPressed()
local success, result = pcall(
function()
return SocialService:CanSendGameInviteAsync(player)
end
)
if result == true then
SocialService:PromptGameInvite(player)
end
end
button.MouseButton1Click:Connect(onButtonPressed)
button.TouchTap:Connect(onButtonPressed)