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

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

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.

2 comments

0

What's wrong

0

No errors, it just doesn't change the text.

1 answer

✓ Accepted answer

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.

1 comment

0

thanks! this will really help out my game.

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