I have this script where, if you give an oven chicken it cooks it, and then you can take it back. Everything works fine, except for 1 thing, the first time you collect the chicken you get 1 cooked chicken (normal) but the second time you get chicken, if you put more in, you get 2 chicken (not normal) and the third time you get three chicken and so on. There is no feature in my script where you can put more than one piece of chicken in the oven, so you should only get one piece every time. No idea what going on.
script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local DB = false
local proximityR = script.Parent
local proximityC = script.Parent.Parent.Parent.Cooked.ProximityPrompt
local proximityB = script.Parent.Parent.Parent.Burnt.ProximityPrompt
local ChickenModel = ReplicatedStorage.RawChicken
local ChickenSlice = game.Workspace.RawChickenPiece
local OvenLight = game.Workspace.Oven1.OvenLight.SpotLight
local OvenHeaters = game.Workspace.Oven1.Heaters
local taken = false
--sounds
local Sizzle = script.Parent.Sizzle
local On = script.Parent.On
local Ding = script.Parent.CookedDing
local Door = script.Parent.Door
local Fire = script.Parent.Fire
--
function Cooked(Player)
proximityC.Enabled = false
taken = true
print("Cooked and ready!!")
OvenHeaters.Color = Color3.fromRGB(27, 42, 53)
OvenLight.Brightness = 0
Sizzle.Looped = false
Sizzle:Stop()
ChickenSlice.Union.Transparency = 1
ChickenSlice.Union.Color = Color3.fromRGB(224, 178, 208)
local ChickenCTool = ReplicatedStorage.CookedChicken:Clone()
local character = Player.Character or Player.CharacterAdded:Wait() -- gets the player's character
local humanoid = character:FindFirstChildOfClass("Humanoid") -- get the humanoid
ChickenCTool.Parent = Player.Backpack -- put in backpack
humanoid:EquipTool(ChickenCTool) --equip the tool
local weld = Instance.new("Weld")
weld.Part0 = ChickenCTool.CookedChicken.Handle
weld.Part1 = character["Right Arm"]
weld.C0 = CFrame.new(0, 1.07, 0)
weld.Parent = ChickenCTool.CookedChicken.Handle
wait(1)
proximityR.Enabled = true
DB = false
wait(4)
taken = false
end
function Burnt(Player)
print("bruv u burned it")
ChickenSlice.Union.Transparency = 1
proximityB.Enabled = false
OvenHeaters.Color = Color3.fromRGB(27, 42, 53)
OvenLight.Brightness = 0
Sizzle.Looped = false
Sizzle:Stop()
ChickenSlice.Union.Color = Color3.fromRGB(224, 178, 208)
local ChickenBTool = ReplicatedStorage.BurntChicken:Clone()
local character = Player.Character or Player.CharacterAdded:Wait() -- gets the player's character
local humanoid = character:FindFirstChildOfClass("Humanoid") -- get the humanoid
ChickenBTool.Parent = Player.Backpack -- put in backpack
humanoid:EquipTool(ChickenBTool) --equip the tool
local weld = Instance.new("Weld")
weld.Part0 = ChickenBTool.BurntChicken.Handle
weld.Part1 = character["Right Arm"]
weld.C0 = CFrame.new(0, 1.07, 0)
weld.Parent = ChickenBTool.BurntChicken.Handle
wait(1)
proximityR.Enabled = true
DB = false
end
proximityB.Enabled = false
proximityC.Enabled = false
proximityR.Triggered:Connect(function(Player)
if not DB then
local Chicken = Player.Character:FindFirstChild("RawChicken")
if Chicken then
DB = true
--|Position and cloning|--
Chicken:Destroy()
proximityR.Enabled = false
--|Looks|--
OvenHeaters.Color = Color3.fromRGB(255, 107, 18)
OvenLight.Brightness = 100
ChickenSlice.Union.Transparency = 0
--|Cooking|--
wait(.5)
Sizzle:Play()
Sizzle.Looped = true
wait(5)
ChickenSlice.Union.Color = Color3.fromRGB(232, 198, 136)
proximityC.Enabled = true
print("ready")
proximityC.Triggered:Connect(Cooked)
Ding:Play()
wait(5)
--|Burnt|--
if not taken then
proximityC.Enabled = false
proximityB.Enabled = true
ChickenSlice.Union.Color = Color3.fromRGB(39, 39, 39)
proximityB.Triggered:Connect(Burnt)
print("Burning")
end
end
end
end)