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

Why does this only work for one vending machine? [closed]

Asked by 8 years ago
local player = game.Players.LocalPlayer

for index, swag in pairs(workspace:GetChildren()) do
    if swag.Name == "DylansVendingMachine" then
        dank = swag.Buttons.SurfaceGui
    end
end

dank.Coke.MouseButton1Click:connect(function()
    local memes = game.Lighting.Coke:Clone()
    memes.Parent = player.Backpack
end)

dank.MtnDew.MouseButton1Click:connect(function()
    local memes = game.Lighting["Mtn Dew"]:Clone()
    memes.Parent = player.Backpack
end)

dank.Pepsi.MouseButton1Click:connect(function()
    local memes = game.Lighting.Pepsi:Clone()
    memes.Parent = player.Backpack
end)

dank.DrPepper.MouseButton1Click:connect(function()
    local memes = game.Lighting.DrPepper:Clone()
    memes.Parent = player.Backpack
end)


1
you should not use Lighting to store models ect use server storage, replicated storage User#5423 17 — 8y
0
Alright but that doesn't answer my question dylan1406599 0 — 8y

Closed as Not Constructive by ScriptGuider, TheHospitalDev, Tigerism, and User#5423

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?