Why does this only work for one vending machine? [closed]
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)
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?