You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
Check if player owns a gamepass
-
What is the issue? Include screenshots / videos if possible!
Not working
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(Player)
wait(5)
-- ReceptionGui
print(tostring(game:GetService("GamePassService"):UserOwnsGamePassAsync(Player.UserId, 27762441)))
Player.PlayerGui:FindFirstChild("ReceptionGui").Frame.Visible = false
if game:GetService("GamePassService"):UserOwnsGamePassAsync(Player.UserId, 27762441) then
Player.PlayerGui:FindFirstChild("ReceptionGui").Open.Visible = true
Player.PlayerGui:FindFirstChild("ReceptionGui").Frame.Visible = false
else
Player.PlayerGui:FindFirstChild("ReceptionGui").Open.Visible = false
Player.PlayerGui:FindFirstChild("ReceptionGui").Frame.Visible = false
end
end)
i am getting this error:
UserOwnsGamePassAsync is not a valid member of GamePassService "GamePassService"
It’s
game:GetService("MarketplaceService"):UserOwnsGamePassAsync(UserId, GamePassId)
Orbular3
(Orbular3)
3
Use MarketPlaceService instead with the same function
it now works but it returns false when i do own it. what should i try?
Did you enter the correct GamePassId?
yea i did. i also made the game pass
Orbular3
(Orbular3)
8
Is the game uploaded to roblox and everythiing
Yea it is uploaded to roblox and published
this is the script now:
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(Player)
game.Workspace:WaitForChild(Player.Name)
wait(5)
Player.PlayerGui:FindFirstChild("ReceptionGui").Open.Visible = false
Player.PlayerGui:FindFirstChild("ReceptionGui").Frame.Visible = false
-- ReceptionGui
print(tostring(game:GetService("MarketplaceService"):UserOwnsGamePassAsync(Player.UserId, 27762441)))
Player.PlayerGui:FindFirstChild("ReceptionGui").Frame.Visible = false
wait(12)
print(tostring(game:GetService("MarketplaceService"):UserOwnsGamePassAsync(Player.UserId, 27762441)))
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(Player.UserId, 27762441) then
Player.PlayerGui:FindFirstChild("ReceptionGui").Open.Visible = true
Player.PlayerGui:FindFirstChild("ReceptionGui").Frame.Visible = false
else
Player.PlayerGui:FindFirstChild("ReceptionGui").Open.Visible = false
Player.PlayerGui:FindFirstChild("ReceptionGui").Frame.Visible = false
end
end)
I just entered the GamePassId and it’s from a different group?
So you don’t own it. Unless you’re on an alt?
Orbular3
(Orbular3)
12
Maybe try defining the market place service in a variable then using that instead of game:GetService
Oh cause i uploaded it to my group. dosent it automaticly gives it to the owner?
Check your inventory. You don’t own it on your current account if you don’t purchase it or create it yourself.
try this;
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(Player)
wait(5)
print(tostring(game:GetService("MarketplaceService"):UserOwnsGamePassAsync(Player.UserId, 27762441)))
Player.PlayerGui:FindFirstChild("ReceptionGui").Frame.Visible = false
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(Player.UserId, 27762441) then
Player.PlayerGui:FindFirstChild("ReceptionGui").Open.Visible = true
Player.PlayerGui:FindFirstChild("ReceptionGui").Frame.Visible = false
else
Player.PlayerGui:FindFirstChild("ReceptionGui").Open.Visible = false
Player.PlayerGui:FindFirstChild("ReceptionGui").Frame.Visible = false
end
end)
turns out if you make a gamepass in a group it wont give you it.