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

How do I change a TextLabel if a player owns a gamepass?

Asked by 4 years ago

Hi, 3rd post. I am working on a GUI game, you know like flamingo tracker? Anyway, my game has a Pro version which gives you access to more stuff. I want to put in "Paid Version" if they own the Pro version, here is my script.

local mps = game:GetService("MarketplaceService")
local gamepass = 9697944
game.Players.PlayerAdded:connect(function(player)
if mps:UserOwnsGamePassAsync(player.UserId,gamepass) then
script.Parent.Text = "Paid Version"
end
end)

If you help thanks.

0
What's wrong Ziffixture 6913 — 4y
0
No errors, it just doesn't change the text. NotRobloxMonch 11 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

Make sure this is in a local script.

local playerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
local mps = game:GetService("MarketplaceService")
local gamepass = 9697944
game.Players.PlayerAdded:connect(function(player)
    if mps:UserOwnsGamePassAsync(player.UserId,gamepass) then
        playerGui.YourScreenGui... -- After you put your screenGui put what comes after it.
    end
end)

The PlayerGui is what the player sees, and you change text within the PlayerGui.

0
thanks! this will really help out my game. NotRobloxMonch 11 — 4y
Ad

Answer this question