Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago
Edited 4 years ago

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)
0
Have you tested the script out and got an error? spot6003 64 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

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.

Ad

Answer this question