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

My 2x Gamepass script isn't working?... Anyone know why?.. Makes no sense!

Asked by 6 years ago

Okay, so in the LocalScript of my tool, I check if the player has the Gamepass. If they don't they get default amount of points per activation, if they do they get double.

Here is my script, do you see any reason why it shouldn't be working?

player = game.Players.LocalPlayer

local debounce = false

local function onEquipped()

end

local function onUnequipped()

end

local function onActivated()
    if debounce == false then

        debounce = true
        script.Parent.Handle.Sound:Play()
    if player:FindFirstChild("leaderstats") then
        if player.leaderstats:FindFirstChild("Points") then
            if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, 4587718) then
                player.leaderstats.Points.Value = player.leaderstats.Points.Value + 20000
                wait(2.716)
                debounce = false
            else
                player.leaderstats.Points.Value = player.leaderstats.Points.Value + 10000
                wait(2.716)
                debounce = false
            end
        end
    end
end
end

script.Parent.Equipped:connect(onEquipped)
script.Parent.Unequipped:connect(onUnequipped)
script.Parent.Activated:connect(onActivated)

Any answers will be greatly appreciated!

Answer this question