I made a script that want to reward a Player if he/she owns the gamepass. The function of it is to get “Starters Money” In-Game. I made a script for it.
local groupID = 10790270
local gamepassID = 18107316
local MPS = game:GetService(“MarketplaceService”)
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new(“Folder”)
leaderstats.Parent = player
leaderstats.Name = “leaderstats”
– Starters Money Gamepass
if player:OwnsGamePassAsync(player.UserId,gamepassID) then
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 500
end
end
end)
You could just reference the conditional checks as their own statements, you don’t need to check if both the Player is in the group & checking for the gamepass as well if that’s what you mean?
local groupID = 10790270
local gamepassID = 18107316
local MPS = game:GetService("MarketplaceService")
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Parent = player
leaderstats.Name = "leaderstats"
local Coins = Instance.new("IntValue")
Coins.Name = "Coins"
Coins.Parent = leaderstats
Coins.Value = 0
--Group Members Reward
if player:IsInGroup(groupID) then
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 100
end
--Starters Money Gamepass
if MPS:UserOwnsGamePassAsync(player.UserId,gamepassID) then
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 500
end
end)
Edit: WAIT A SECOND “OwnsGamePassAsync” IS NOT VALID, TRY THIS INSTEAD