#Restocking Error 2nd time
6 messages · Page 1 of 1 (latest)
One sec
~~
local ThisBG = script.Parent
local BValue = BG.BurgersGrabbed
local CD = script.Parent.ClickDetector
local ErrorSound = script.Parent.Error
local PurchaseSound = script.Parent.purchase
local ErrorColor = Color3.new(1, 0, 0.0156863)
local PurchaseColor = Color3.new(0, 1, 0.0666667)
local OrginColor = ThisBG.Color
local Price = 100
CD.MouseClick:Connect(function(Player)
local leaderstats = Player:WaitForChild("leaderstats")
local Money = leaderstats:WaitForChild("Money")
local function Run()
PurchaseSound:Play()
ThisBG.Color = PurchaseColor
Money.Value -= Price
BValue.Value = 0
wait(2)
PurchaseSound:Stop()
ThisBG.Color = OrginColor
end
local function Run2()
ErrorSound:Play()
ThisBG.Color = ErrorColor
warn("Not enough Money")
wait(2)
ErrorSound:Stop()
ThisBG.Color = OrginColor
end
if Money.Value >= Price then
if BValue.Value == 0 then return end
if BValue.Value ~= 0 and BValue.Value == 10 then
Run()
end
elseif Money.Value < Price then
Run2()
end
end)``` code for the restock box
local RS = game:GetService("ReplicatedStorage")
local BG = script.Parent.BillboardGui
local TextLabel = BG.TextLabel
local MaxBurgers = 10
local value = script.Parent.BurgersGrabbed
local function FormatText()
TextLabel.Text = "Burgers: "..value.Value.."/"..MaxBurgers
value.Changed:Connect(function()
TextLabel.Text = "Burgers: "..value.Value.."/"..MaxBurgers
end)
end
FormatText()
local IsNotUsing = false
CD.MouseClick:Connect(function(Player)
local function Run3()
value.Value += 1
local Burger = RS.Burger:Clone()
Burger.Parent = Player.Backpack
end
if not IsNotUsing then
IsNotUsing = true
Run3()
if value.Value >= MaxBurgers then return end
wait(1)
IsNotUsing = false
end
end)``` code for the burger Giver
I could probably fix it myself but I feel like my brain cells are to fried lol