Jump to content

roblox lua script for gamepass not working

Takt1kal

This script is supposed to change the surroundings from neon to smooth plastic, if a gamepass is owned. It's just not working (without an error)

local id = 17088519

game:GetService("MarketplaceService").PromptGamePassPurchaseFinished:Connect(function(plr,ido,purchased)
    if purchased and ido == id then
        local InstanceThatContainsMyParts = workspace.FolderContainingParts

        for i,v in pairs(InstanceThatContainsMyParts:GetChildren()) do
            if v:IsA("BasePart") then
                v.Material = Enum.Material.SmoothPlastic
            end
        end
    end
end)

game.Players.PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:connect(function(char)
        if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(game.Players[char.Name].UserId, id) then
            local InstanceThatContainsMyParts = workspace.FolderContainingParts

            for i,v in pairs(InstanceThatContainsMyParts:GetChildren()) do
                if v:IsA("BasePart") then
                    v.Material = Enum.Material.SmoothPlastic
                end
            end
        end
    end)
end)

Thanks.

Link to comment
Share on other sites

Link to post
Share on other sites

27 minutes ago, knockless said:

This script is supposed to change the surroundings from neon to smooth plastic, if a gamepass is owned. It's just not working (without an error)


local id = 17088519

game:GetService("MarketplaceService").PromptGamePassPurchaseFinished:Connect(function(plr,ido,purchased)
    if purchased and ido == id then
        local InstanceThatContainsMyParts = workspace.FolderContainingParts

        for i,v in pairs(InstanceThatContainsMyParts:GetChildren()) do
            if v:IsA("BasePart") then
                v.Material = Enum.Material.SmoothPlastic
            end
        end
    end
end)

game.Players.PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:connect(function(char)
        if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(game.Players[char.Name].UserId, id) then
            local InstanceThatContainsMyParts = workspace.FolderContainingParts

            for i,v in pairs(InstanceThatContainsMyParts:GetChildren()) do
                if v:IsA("BasePart") then
                    v.Material = Enum.Material.SmoothPlastic
                end
            end
        end
    end)
end)

Thanks.

a better place to post this would be the roblox developer forums

my signiture was cool, but its a lie now

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×