Hi! So i tried to make a frame get visible if player owns a gamepass, and the script isnt working ):
Heres my script:
local gamepassID = 12524399
local MarketplaceService = game:GetService("MarketPlaceService")
game.Players.PlayerAdded:Connect(function(player)
if MarketplaceService:UserOwnsGamePassAsync(player.UserId, gamepassID) then
script.Parent.Visible = true
end
end)
local gamepassID = 12524399
local MarketplaceService = game:GetService("MarketPlaceService")
game.Players.PlayerAdded:Connect(function(player)
if MarketplaceService:UserOwnsGamePassAsync(player.UserId, gamepassID) then
--to clone a UI
local UI = script.ScreenGui:clone()
UI.Parent = player.PlayerGui
UI.Frame.Visible = true
--to visible an exisiting UI
local GUI = player.PlayerGui["YOUR_GUI"]
if GUI then
local frame = GUI["FRAME"]
if frame then
frame.Visible = true
end
end
end
end)
local gamepassID = 12524399
local MPS = game:GetService("MarketPlaceService")
local Player = game:GetService("Players").LocalPlayer
repeat task.wait() until Player.Character
if MPS:UserOwnsGamePassAsnyc(Player.UserId,gamepassID) then
--Make UI's frame visible
end