Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do you make a game pass where you have to own it to be on a team?

I'm asking cause I don't know how to script vary well. But here's what I got.

local gamepassID = 8852294 
script.Parent.MouseButton1Click:connect(function (playerWhoClicked)
    local player = game.Players.LocalPlayer
    local gps = game:GetService("GamePassService")
    local playerHasPass = gps:PlayerHasPass(player, gamepassID)
 
    if playerHasPass then
    player.Team.Name = Site Adminastrator
    else
        gps:PromptPurchase(player, gamepassID)
    end
end)

1 comment

0

Have you tested the script out and got an error?

1 answer

First of all, use MarketplaceService:UserOwnsGamepassAsync. Second of all, don’t set the name of team they're currently on, do something like player.Team = game.Teams[“Site Administrator”]. I think you need to run it on the server side, so use a remote event instead because changing the team won’t replicate anyways and MarketplaceService should be done on the server.

This discussion is preserved as it was. New answers, comments, and votes are closed.