Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

output says "Gamepasses isn't a valid member of player"?

Asked by 4 years ago

So I made a server script that made a new folder called "Gamepasses" and inside the folder is a boolvalue named "BlueFire" and is set to false

what I want to do with the gamepass is set that value to true

local id = 9736269

game:GetService("MarketplaceService").PromptGamePassPurchaseFinished:Connect(function(plr,ido,purchased)
    if purchased and id == ido then
        plr.Gamepasses.BlueFire.Value = true
    end
end)

game.Players.PlayerAdded:Connect(function(plr)
    if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(plr.UserId,id) then
        game.Players:WaitForChild(plr.Name).Gamepasses.BlueFire.Value = true
    end
end)

It was working fine but then I added datastore2 and some reason it doesn't work idk y.

0
I'm not sure why you are adding datastores for gamepass you just need to out an if statement for if the player owns the gamepass FluffySheep46209 369 — 4y
0
I didn't add a datastore for gamepass, I added a data store for a money value and I didn't change the gamepass code AT ALL. Idk why its doing this JustPapi 49 — 4y

1 answer

Log in to vote
1
Answered by 4 years ago

Try something like this

local Lighting = game:GetService("Lighting")
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local gamepassId = 8900287 --Put the ID of the asset here


local function onPlayerAdded(player)
    local function onCharacterAdded(character)
        if MarketplaceService:UserOwnsGamePassAsync(player.UserId, gamepassId) then

                    player.Gamepasses.BlueFire.Value = true




                end   



            end


    if player.Character then
        onCharacterAdded(player.Character)
    end
    player.CharacterAdded:Connect(onCharacterAdded)
end

Players.PlayerAdded:Connect(onPlayerAdded)
0
it still doesn't work it just says "Gamepasses is not a valid member of Player". This is the script I did to add the BlueFire bool value. local gp = Instance.new("Folder", plr) gp.Name = "Gamepasses" local bFire = Instance.new("BoolValue", gp) bFire.Name = "BlueFire" bFire.Value = false JustPapi 49 — 4y
1
nvm I got it now I just needed WaitForChild on the gamepass. thanks for helping me tho JustPapi 49 — 4y
0
np FluffySheep46209 369 — 4y
Ad

Answer this question