Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

I'm making a Bakery Group on roblox. A script doesn't work, can anybody help?

So, I'm making a ROBLOX Bakery group, and the script for the Donut Tray in the oven is:

local donut = game.ReplicatedStorage.Donut:Clone()
local baking = game.ReplicatedStorage.Baking:Clone()
script.Parent.ClickDetector.MouseClick:Connect(function(Player)
	if Player.Backpack:FindFirstChild("Donut Tray") then
game.ReplicatedStorage.Baking:Clone()
baking.Parent = Player.PlayerGui
Player.Backpack["Donut Tray"]:Destroy()
wait(20)
game.ReplicatedStorage.Donut:Clone()
donut.Parent = Player.Backpack
	end
end)

But for some reason, it doesn't work, and nothing in the output is wrong..

Help?

2 comments

1

Use the "lua" image and put your code inside to format it better

0

Done.

1 answer

This was just so I could see it. I did not answer it.

local donut = game.ReplicatedStorage.Donut:Clone()
local baking = game.ReplicatedStorage.Baking:Clone() 

script.Parent.ClickDetector.MouseClick:Connect(function(Player) 
	if Player.Backpack:FindFirstChild("Donut Tray") then 	
		game.ReplicatedStorage.Baking:Clone() 
		baking.Parent = Player.PlayerGui 
		Player.Backpack["Donut Tray"]:Destroy() wait(20) 		
		game.ReplicatedStorage.Donut:Clone() 
donut.Parent = Player.Backpack 
end 
end)

You should start formatting your code if you didn't. Don't know why there is a wait(20). That seems unnecessary lol.

What about this is not working correctly? Everything is "correct" in what you are doing but probably wrong for the task that you want. What do you want this code to do?

1 comment

0

Wait 20 is the baking time. And, what I want it to do is if you have a Donut Tray, it'll pop up with a gui and destroy your donut tray. The gui has the time it's cooking, and after the time, it'll give you the cooked food. But, it never shows the GUI, and never does anything else either.

This discussion is preserved as it was. New answers, comments, and votes are closed.