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

SCRIPT WONT WORK, PLEASE HELP! Script where if players have certain item they get free coins? [closed]

Asked by 5 years ago

SCRIPT WONT WORK, PLEASE HELP! I need a script where if players have certain gamepass they get free coins! I need this so creators get free stuff, please help!

Closed as Not Constructive by Link150

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
-2
Answered by 5 years ago

Ok, your not supposed to ask for stuff without showing script but ok.

-- If you do not know how to use this or the GUI, check out my YouTube video tutorial on this. 
-- Replace the 0's with your ID's 
-- Delete what you dont use, besides the first part of the function


game.StarterGui.ResetPlayerGuiOnSpawn = false
old_fog = game.Lighting.FogStart
local MarketplaceService = game:GetService("MarketplaceService")

function getPlayerFromId(id)
    for i,v in pairs(game.Players:GetChildren()) do
        if v.userId == id then
            return v
        end
    end
    return nil
end

MarketplaceService.ProcessReceipt = function(receiptInfo)
    local productId = receiptInfo.ProductId
    local playerId = receiptInfo.PlayerId
    local player = getPlayerFromId(playerId)
    local productName 

    -- Down below is an example of a Cash boost

    -------------------------------------------------------------------

    if productId == 50738839 then
        local cashmoney = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
            if cashmoney then
                cashmoney.Value = cashmoney.Value + 5000
                   end
    elseif productId ==50738869  then
        local cashmoney = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
            if cashmoney then
                cashmoney.Value = cashmoney.Value + 10000
            end
    elseif productId == 50738905 then
        local cashmoney = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
            if cashmoney then
                cashmoney.Value = cashmoney.Value + 20000
            end
    elseif productId == 50738942 then
        local cashmoney = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
            if cashmoney then
                cashmoney.Value = cashmoney.Value + 30000
            end 
    elseif productId == 50738971 then
        local cashmoney = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
            if cashmoney then
                cashmoney.Value = cashmoney.Value + 40000
            end
    elseif productId == 50739005 then
        local cashmoney = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
            if cashmoney then
                cashmoney.Value = cashmoney.Value + 99999999999
            end




        -------------------------------------------------------------------

        -- Down below is an example of a Health boost

        -------------------------------------------------------------------
        elseif productId == 52085900 then
        local char = player.Character
        if char then
            local human = char:FindFirstChild("Humanoid")
            if human then
                human.WalkSpeed = human.WalkSpeed + 15
            end
        end
        -------------------------------------------------------------------

        -- Down below is an example of a WalkSpeed boost

        -------------------------------------------------------------------
        elseif productId == 52086187 then
        local cashmoney = game.ServerStorage.MoneyStorage:FindFirstChild(player.Name)
        local char = player.Character
        char.Humanoid.MaxHealth = char.Humanoid.MaxHealth + 30
        wait()
        char.Humanoid.Health = char.Humanoid.MaxHealth
        -------------------------------------------------------------------

        -- Down below is an example of a gear giver

        -------------------------------------------------------------------

        elseif productId == 52086215 then
        game.ServerStorage.Rainbow:Clone().Parent=player.Backpack

        -------------------------------------------------------------------
    end
    return Enum.ProductPurchaseDecision.PurchaseGranted     
end
Ad