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

Why Isn't the tool upgrading Itself even If the owner bought the gamepass?

Asked by 1 year ago

Ello Developers!

I've made this simple script (Server-Script) that when the player equips a certain Item, the original Item upgrades Itself via cloning a different Item and deleting Itself, the problem Is that even If the player has the gamepass, It doesn't really do anything

Script:

local Tool = script.Parent

local GamePassID = 34342176

local MarketPlace = game:GetService("MarketplaceService")

Tool.Equipped:Connect(function()
    game:GetService("Players").PlayerAdded:Connect(function(Plr)
        local PlayerHasGamePass = MarketPlace:UserOwnsGamePassAsync(Plr.UserId,GamePassID)
        if PlayerHasGamePass then
            local GamerCard = game:GetService("ReplicatedStorage").Upgrades.Cards["Gamers Card"]:Clone()
            GamerCard.Parent = Tool.Parent
            Tool:Destroy()
        elseif not PlayerHasGamePass then
            print("This User Did Not Bought The GamePass!")
        end
    end)
end)
1
May I have some extra context? When are players given this tool? Neatwyy 123 — 1y
0
Only players who have purchase a certain gamepass, like a V.I.P Gamepass imnotaguest1121 362 — 1y

Answer this question