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

Getting elself error for reasons i don't understand?

Asked by 9 years ago

So, I am working on a tycoon game and I was working on my Dev Product Shop and I got this annoying error when editing the code. Any ideas on how to fix this?

game.StarterGui.ResetPlayerGuiOnSpawn = false

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 
    if productId == 23783774 then
        productName = "$10,000+ Cash Boost"
        local cashmoney = game.ServerStorage.MoneyStorage:FindFirstChild(player.Name)
        if cashmoney then
            cashmoney.Value = cashmoney.Value + 10000
        end
    elseif productId == 23783774 then
        productName = "$50,000+ Cash Boost"
        local cashmoney = game.ServerStorage.MoneyStorage:FindFirstChild(player.Name)
        if cashmoney then
            cashmoney.Value = cashmoney.Value + 10000
        end
    elseif productId == 23783946 then
        productName = "+5 Walkspeed [STACKS]"
        local char = player.Character
        if char then
            local human = char:FindFirstChild("Humanoid")
            if human then
                human.WalkSpeed = human.WalkSpeed + 5
        end
    elseif productId == 24133649 then
        productName = "+25 Health Boost [STACKS]"
        local char = player.Character
        if char then
            local human = char:FindFirstChild("Humanoid")
            if human then
                human.MaxHealth = human.MaxHealth + 25
                human.Health = human.Health + 25
        end
    elseif productId == 23783812 then
        productName = "Gravity Coil [1 LIFE]"
        game.Lighting.GravityCoil:Clone().Parent = player.Backpack
        end
    elseif productId == 24133964 then
        productName = "Jetpack [1 LIFE]"
        game.Lighting.Jetpack:Clone().Parent = player.Backpack
        end
    elseif productId == 24139536 then
        productName = "Minigun [1 LIFE]"
        game.Lighting.Minigun:Clone().Parent = player.Backpack
       end
    elseif productId == 23918487 then
        productName = "NUKE [1 TIME USE]"
        game.Lighting.Nuke:Clone().Parent = game.Workspace
     end
    return Enum.ProductPurchaseDecision.PurchaseGranted
end

Expected 'end' (to close 'function' line 14), got 'elself' is the error Thanks for looking!

0
I am probably wrong, as I am not a very good scripter, but I don't believe you end every single elseif, try just having the one end, and then the second end, after return" yogipanda123 120 — 9y

1 answer

Log in to vote
0
Answered by
Scriptecx 124
9 years ago

Is there anything in the output?

0
No. It says the error is in line 14 Though witch i don't understand. P.S the error showed up after adding the nuke. ShadowShocks 42 — 9y
0
The exact error is "Expected 'end' (to close 'function' line 14), got 'elself'" ShadowShocks 42 — 9y
Ad

Answer this question