Now here is my script (It is supposed to remove the ImageButton and Frame1 which is inside Frame if player doesn't have the gamepass):
id = 382406860 --Gamepass Id plr = script.Parent.Parent.Parent.Parent repeat wait() until plr.PlayerGui if not plr:PlayerHasPass(id) then script.Parent.Parent.Parent.Frame.Frame1:Destroy() wait(0.1) script.Parent:Destroy() end
I'm not sure what went wrong... Does anyone know and can help me?
You dont use player. you use GamePassService. BUUUUTTT lets ditch this method. just DONT. players have to rejoin if you use that. Lets rewrite this with PlayerOwnsAsset.
id = 382406860 --Gamepass Id local MarketPlace = game:GetService("MarketPlaceService") plr = script.Parent.Parent.Parent.Parent repeat wait() until plr.PlayerGui if not MarketPlace:PlayerOwnsAsset(plr, id) then -- use Marketplace, put plr in the parenthese script.Parent.Parent.Parent.Frame.Frame1:Destroy() wait(0.1) script.Parent:Destroy() end
Vote up if i helped! Comment back if it didnt!