How can I make it if a user buys paid access to my game, they get a special text ui over their name?

How can I make it if a user buys paid access to my game, they get a special text ui over their name?

Similar to this, however they must own PAID ACCESS to my game.

4 Likes

This is very very easy! I’ve actually done this for several games, you just need to add a simple line if statement. :wink:

local player = "whatyoudefineitas"
local MPS = game:GetService("MarketplaceService")
if MPS:PlayerOwnsAsset(player, gameID) then
--thestuff you need

Basically if a player purchases access to a game, it works the exact same as any other asset, and this is how many games do “Alpha” and other chat tags. If you check a users inventory , and check purchased games it will show all games they purchased. This works the same way for MPS. If you need any more help, let me know!

5 Likes

How should this look in my studio?

Also, what is “whatyoudefineitas”

That was put there because that is where you define what the player is. So basically something like:

game.Players.PlayerAdded:Connect(function(player)
– Defines the player and starts the script once the player joins
local ID = – game ID Here
if game:GetService(“MarketplaceService”):PlayerOwnsAsset(player, ID) then
local NameTag = – Define where the over head GUI is
– Clone the NameTag and then set the Parent of it to the head

end
end)

What would a fully functional script look like?

To add onto this, you could use a value which is in the player through a Leaderboard script, and then where @Kensizo says --thestuff you need, say:

player.PlayedInEarlyAccess.Value = true

Then remove this line when your game is no longer Paid Access.

1 Like

My scripter doesnt understand what “whatyoudefineas” Can you put it in more context?

The player variable should be the player object you want to check.

Anything you want. You can replace that variable with

game.Players.PlayerAdded:connect(function(player)

and

end)

at the end of the function, or anything like that.

How would I define the location?

Can you please provide an example?

What location, sorry? I’ll write you an example script.

local MPS = game:GetService("MarketPlaceService")
local gameID = game.GameId

game.Players.PlayerAdded:Connect(function(player)
    if MPS:PlayerOwnsAsset(player, gameID) then
        local newTag = game.ReplicatedStorage.Nametag:Clone()
        newTag.Parent = player.Character.Head
        newTag.TextLabel.Text = player.Name .. " [PAID ACCESS!]"
    end
end)

End result:

The end result should have a Nametag BillboardGui, originally set in ReplicatedStorage but cloned to the Player’s head, in the player’s head. The text should read:

MaximussDev [PAID ACCESS!]

Keep in mind, to achieve the Nametag floating above head effect, you must set the BillboardGui’s StudsOffset property to about:

Vector3.new(0,5,0)


Hope this helped!

2 Likes

Where would player.PlayedInEarlyAccess.Value = true come into place?

If you had a leaderstats script.

For example:

This should be in a separate script, by the way. In ServerScriptService, may I add.

game.Players.PlayerAdded:connect(function(player)
    local PlayedInEarlyAccess = Instance.new("BoolValue", player)
    PlayedInEarlyAccess.Name = "PlayedInEarlyAccess"
end)
1 Like

A datastore would possibly be needed to make sure they keep the UI, correct.?

Yes. Datastores should be in a pCall though.

1 Like

Please be aware, this script also works if the person bought a VIP server.

That wouldve been nice to know awhile ago,

Does anyone have an accurate idea on how I can do this for PAID ACCESS ONLY

I don’t think that is possible.

Btw, is it currently paid access?

Yup! So that’s why I thought maybe it would work when you put a line into the code producing a value and changing the value, then remove the changing value when Paid Access is over.

Let’s say, for example, you make a game called “Salami Simulator,” and it was Paid Access, you would have VIP Servers off by default. You would use the code above, including the line of “PlayedInEarlyAccess.” You’d change that value to true if the player joined, and then when you disable paid access, you’d also remove that line in the script. This way, you’ll only have the players who bought the game first with the value set to true.