Basically Im coming back to some really old code I wrote and to no surprise it is not good. I returned to it to add some module functionalities and now I realized just how buggy it is. It is managing 4 fry baskets and if an old one comes up while a current one is down it just resets everything. I’ve been scripting stuff for 4 hours now so i really don’t want to have to pick through that old script and fix it.
Yes this is a server script.
If anyone has time to waste and would like to help me I’d appreciate it
local GrillPrompt = game.Workspace.CookingStuff.Grill.GrillTop.Grill
local module = require(script.Parent.Inventories)
GrillPrompt.PromptButtonHoldBegan:Connect(function()
game.SoundService["Frying Food"]:Play()
end)
GrillPrompt.PromptButtonHoldEnded:Connect(function()
game.SoundService["Frying Food"]:Stop()
end)
GrillPrompt.Triggered:Connect(function(player)
local checkTable = module.Get(player)
if checkTable["Lower burger bun"] and checkTable["Upper burger bun"] then
module.Remove(player, game.ReplicatedStorage.Tools["Upper burger bun"])
module.Remove(player, game.ReplicatedStorage.Tools["Lower burger bun"])
module.add(player, game.ReplicatedStorage.Tools["Cooked Lower burger bun"])
module.add(player, game.ReplicatedStorage.Tools["Cooked Upper burger bun"])
return
elseif checkTable["Upper burger bun"] then
module.Remove(player, game.ReplicatedStorage.Tools["Upper burger bun"])
module.add(player, game.ReplicatedStorage.Tools["Cooked Upper burger bun"])
return
elseif checkTable["Lower burger bun"] then
module.Remove(player, game.ReplicatedStorage.Tools["Lower burger bun"])
module.add(player, game.ReplicatedStorage.Tools["Cooked Lower burger bun"])
end
end)
local FryDB = false
local HoldEndedConnection
function startFrying(prompt, player)
if FryDB then return end
FryDB = true
local breakCon = false
game.SoundService["Frying Food"]:Play()
local function fryDown()
repeat
if breakCon == true then
breakCon = false
break
end
for i, part in pairs(prompt.Parent.Parent:GetChildren()) do
part.Position -= Vector3.new(0, 0.00628, 0)
end
task.wait(0.02)
until prompt.Parent.Position.Y <= 4.555
end
local function fryUp()
repeat
prompt.Enabled = false
for i, part in pairs(prompt.Parent.Parent:GetChildren()) do
part.Position += Vector3.new(0, 0.00628, 0)
end
task.wait(0.02)
until prompt.Parent.Position.Y >= 4.965
game.SoundService["Frying Food"]:Stop()
FryDB = false
prompt.Enabled = true
end
task.spawn(fryDown)
if HoldEndedConnection ~= nil then
HoldEndedConnection:Disconnect()
end
HoldEndedConnection = prompt.PromptButtonHoldEnded:Connect(function()
breakCon = true
HoldEndedConnection:Disconnect()
task.spawn(fryUp)
end)
prompt.Triggered:Connect(function()
FryDB = false
end)
end
for i, prompt in pairs(game.Workspace.CookingStuff["Commercial Deep Fryer"]:GetDescendants()) do
if prompt:IsA("ProximityPrompt") and FryDB == false then
prompt.PromptButtonHoldBegan:Connect(function(player)
local checkTable = module.Get(player)
if checkTable["Cold Fries"] then
startFrying(prompt, player)
end
end)
end
end
for i, prompt in pairs(game.Workspace.CookingStuff["Commercial Deep Fryer"]:GetDescendants()) do
if prompt:IsA("ProximityPrompt") and FryDB == false then
prompt.Triggered:Connect(function(player)
module.Remove(player, game.ReplicatedStorage.Tools["Cold Fries"])
module.add(player, game.ReplicatedStorage.Tools["Fried Fries"])
game.SoundService["Frying Food"]:Stop()
end)
end
end