So whenever the game starts this script should be checking if someone has a VIP game pass; but insteed I get an error from the output that says: UserOwnsGamepassAsync is not a valid member of Player. Please help.
local VIP = require(script.Parent); local WConfig = require(game.ServerScriptService.Windstone.Config); local market = game:GetService("MarketplaceService"); local ID = VIP.infromation.vipID; local clone game.Players.PlayerAdded:Connect(function(player) if player:UserOwnsGamepassAsync(player,ID) then clone=VIP.infromation.vipLeaderstats.ui.vip:Clone(); if player and player.Character and player.Character.Head then clone.Parent = player.Character.Head end end for var1,var2 in pairs(WConfig.Admins,WConfig.EliteAdmins) do if player.Name == var1 or var2 then clone=VIP.infromation.vipLeaderstats.ui.admin:Clone(); if player and player.Character and player.Character.Head then clone.Parent = player.Character.Head end end end end)
Output:
14:25:10.675 - UserOwnsGamepassAsync is not a valid member of Player
If you want to check that if player has that game pass you need to put his UserId then gamepass, so on the line 8 type this:
if player:UserOwnsGamepassAsync(player.UserId,ID) then
You can read more here
Solved by Vulkarin
local VIP = require(script.Parent); local WConfig = require(game.ServerScriptService.Windstone.Config); local market = game:GetService("MarketplaceService"); local ID = VIP.infromation.vipID; local clone game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(chr) if market:UserOwnsGamePassAsync(player.UserId,ID) then clone=VIP.infromation.vipLeaderstats.ui.vip:Clone(); clone.Parent = chr.Head end for var1,var2 in pairs(WConfig.Admins,WConfig.EliteAdmins) do if player.Name == var1 or var2 then clone=VIP.infromation.vipLeaderstats.ui.admin:Clone(); clone.Parent = chr.Head end end end) end)