As you can see, for my team change, if the player does not own the gamepass, a GUI pops up over the team change, saying that they don’t own the correct gamepass. I have tried the script and changed some things over and over, but it hasn’t worked.
Down below, you can see the orders. I want to make it if the player owns the certain gamepass, “Unowned” is not visible.
Please look down below for the current script.
script.Parent.MouseEnter:Connect(function()
script.Parent.BackgroundColor3 = Color3.new(255/255, 200/255, 0/255)
end)
script.Parent.MouseLeave:Connect(function()
script.Parent.BackgroundColor3 = Color3.new(11/255, 11/255, 11/255)
end)
local ownsGamepass = game:GetService("MarketplaceService):UserOwnsGamePassAsync(plr.UserId,99509845)
if ownsGamepass then
script.Parent.Unowned.Visible = false
end
Dont do this, :UserOwnsGamePassAsync() is used as a if statement
local MS = game:GetService("MarketplaceService")
script.Parent.Activated:Connect(function()
if MS:UserOwnsGamePassAsync(plr.UserId,99509845) then
script.Parent.Unowned.Visible = false
end
end)
according to the dev forum, the method yields (the async part also tells us that). I always recommend putting a pcall on a yielding method in the event it does go down and users are in your game
I dont know if this can be helpful but i did something like this with some emotes for my game, and when i buyed the gamepass the gui didnt set the visible property to false so u could click the emote u wanted, so i just tried to reset and it worked, try to reset after u buyed it