Try to make the Script wait for some confirmation that the player has been loaded, for example, wait for his character to be added.
local MS = game:GetService("MarketPlaceService")
local GamePassId =
local Player = game.Players.LocalPlayer
Player.CharacterAdded:Wait()
local HassPass = MarketPlaceService:UserOwnsGamePassAsync(Player.UserId, GamePassId)
if not HassPass then
script.Parent:Destroy()
end
But I suggest that you make the Gui appear to the player if he has the Pass, instead of destroying it if he doesn't.
local MS = game:GetService("MarketPlaceService")
local GamePassId =
local Player = game;Players.LocalPlayer
Player.CharacterAdded:Wait()
local HassPass = MarketPlaceService:UserOwnsGamePassAsync(Player.UserId, GamePassId)
if HassPass then
script.Parent.Enabled = true
end
If it doesn't work, could you return the error to me?
So maybe I can help fix it
:)
1 comment
They did not work, i don't know why but i went on an alt and the gui was still visible.