Hello scripters, I have a food ordering system, however the script is long and takes ages if I want to change something like add / remove an item, here is the main script,
local OrderGui = game.ReplicatedStorage.OrderGui
local player = game:GetService("Players")
local http = game:GetService("HttpService")
local webhook = "" -- Webhook URL here
local groupid = 6418380
local grouprank = 200
game.Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msgenable)
if msgenable == "!enablebooking" then
if plr:GetRankInGroup(groupid) >=grouprank then
script.Value.Value = true
end
end
end)
plr.Chatted:Connect(function(msg)
if msg == "!bookfood" then
if script.Value.Value == false then
else OrderGui:Clone().Parent = plr.PlayerGui
end
local plrhasgui = plr.PlayerGui:WaitForChild("OrderGui")
local plrid = plr.UserId
local plrthumbtype = Enum.ThumbnailType.AvatarBust
local plrthumbsize = Enum.ThumbnailSize.Size420x420
local welcomeimage = player:GetUserThumbnailAsync(plrid, plrthumbtype, plrthumbsize)
local unixtime = os.time()
local format = "Sent at %X %Z on %A %d %B"
local timei = os.date(format, unixtime)
local scroll = plrhasgui.Main.ScrollingFrame
local ordertext = "Place Order"
local ordersenttext = "Order Sent"
local orderpreparing1 = "Preparing."
local orderpreparing2 = "Preparing.."
local orderpreparing3 = "Preparing..."
local foodcoming = "On it's way"
local enjoytext = "Enjoy!"
plrhasgui.Main.TopFrame.plrimage.Image = welcomeimage
plrhasgui.Main.TopFrame.greetingmessage.Text = "Welcome "..plr.Name..", what would you like to order"
-- Tomato Soup
scroll.Tomato_Soup.Order.MouseButton1Click:Connect(function(clicked)
if plr.Backpack:FindFirstChild("Tomato Soup") then
scroll.Tomato_Soup.Order.Text = "Already Ordered"
wait(3)
scroll.Tomato_Soup.Order.Text = ordertext
else
scroll.Tomato_Soup.Order.background.ImageColor3 = Color3.fromRGB(173, 173, 173)
scroll.Tomato_Soup.Order.Text = ordersenttext
wait(5)
scroll.Tomato_Soup.Order.Text = orderpreparing1
wait(1)
scroll.Tomato_Soup.Order.Text = orderpreparing2
wait(1)
scroll.Tomato_Soup.Order.Text = orderpreparing3
wait(1)
scroll.Tomato_Soup.Order.Text = orderpreparing1
wait(1)
scroll.Tomato_Soup.Order.Text = orderpreparing2
wait(1)
scroll.Tomato_Soup.Order.Text = orderpreparing3
wait(1)
scroll.Tomato_Soup.Order.Text = foodcoming
wait(3)
scroll.Tomato_Soup.Order.Text = enjoytext
game.ReplicatedStorage.OrderSysFood["Tomato Soup"]:Clone().Parent = plr.Backpack
wait(2.5)
scroll.Tomato_Soup.Order.Text = ordertext
scroll.Tomato_Soup.Order.background.ImageColor3 = Color3.fromRGB(255, 255, 255)
local sendTomato_Soup = {
["content"] = '',
["embeds"] = {{
["title"] = "Food Ordering",
["description"] = "**"..plr.Name.."** has ordered **Tomato Soup**.",
["thumbnail"] = {url = "http://www.roblox.com/Thumbs/Avatar.ashx?x=150&y=150&Format=Png&username="..plr.Name},
["color"] = 15636761,
["footer"] = {text = timei}
}}
}
sendTomato_Soup = http:JSONEncode(sendTomato_Soup)
http:PostAsync(webhook, sendTomato_Soup)
end
end)
plrhasgui.Main.TopFrame.CloseButton.MouseEnter:Connect(function(closebuttonenter)
plrhasgui.Main.TopFrame.CloseButton.background.ImageColor3 = Color3.fromRGB(136, 38, 39)
end)
plrhasgui.Main.TopFrame.CloseButton.MouseLeave:Connect(function(closebuttonenter)
plrhasgui.Main.TopFrame.CloseButton.background.ImageColor3 = Color3.fromRGB(255, 71, 74)
end)
plrhasgui.Main.TopFrame.CloseButton.MouseButton1Click:Connect(function(closebuttonenter)
plrhasgui:Destroy()
end)
end
end)
plr.Chatted:Connect(function(msgdisable)
if msgdisable == "!disablebooking" then
if plr:GetRankInGroup(groupid) >=grouprank then
script.Value.Value = false
end
end
end)
end)
However the lines between
-- Tomato Soup
And
sendTomato_Soup = http:JSONEncode(sendTomato_Soup)
http:PostAsync(webhook, sendTomato_Soup)
end
end)
I have to do that every single time I add a new tool, and its just infficient. So, I was wondering if anyone could help me make it so that when I put an item of food in a folder It would basically do it for me.