Problem with changing the text

Hello,

So I am creating this system where it you can buy perks and claim perks. I am trying to make it so if you don’t own the game pass it will say “Buy!” but if the owns the gamepass it will say “Claim!”. I am not sure why it will not change though. (not my gamepass just put it there for testing).

local button = script.Parent
local playerid = player.UserId

    game.Players.PlayerAdded:Connect(function(plr)
        	if marketplace:UserOwnsGamePassAsync(playerid, 13958833) then
        		button.Text = "Claim!"
        	else
        		button.Text = "Buy!"
        		end
        	
        end)

Is this a client or server script?

It is a local script so client.

Remove the PlayerAdded event as it only fires for players after the client has loaded.

2 Likes