Burger making script not working

So, after the player cooks all parts of the burger, including two toasted bread, a cooked beef patty, and cheese, they will put it on a plate in order, which is toasted bread, cooked beef patty, cheese, and then another toasted bread, they should be able to click the touch part, and it should give them the completed burger. But then it doesn’t give them the burger though. Everything else works fine for the cooking scripts though.

My server storage where all tools are stored.
Screenshot 2024-02-11 065202

Here below is the script that doens’t work!

local click = script.Parent.TouchPart.ClickDetector
local currentPart = script.Parent.CurrentBurgerPart
local tool = game.ServerStorage["Cheeseburger"]
local burgerParts = script.Parent.BurgerParts

function onClick(player)
	
	if currentPart == 3 then
		currentPart = 0
		burgerParts.BottomBread.Transparency = 0
		burgerParts.BottomBread.CanCollide = false
		
		burgerParts.BeefPatty.Transparency = 0
		burgerParts.BeefPatty.CanCollide = false

		burgerParts.Cheese.Transparency = 0
		burgerParts.Cheese.CanCollide = false
		
		burgerParts.TopBread.Transparency = 0
		burgerParts.TopBread.CanCollide = false
		
		local clone = tool:Clone()
		clone.Parent = player.Backpack
		
	end
	
	
	
end
click.MouseClick:Connect(onClick)
3 Likes

How about making a player equip the tool?
For example

local clone = tool:Clone()
player.Character.Humanoid:EquipTool(clone)

Oh, I forgot to post this, but this is what the burger maker looks like. The script thats not working is the finish burger script

Screenshot 2024-02-11 065354

1 Like

I tried that and it doesn’t work still.
Screenshot 2024-02-11 065804

I put your code here like this,
Screenshot 2024-02-11 065731

does your “tool” has Archivable property on?
There’s no reason for that to not work except the reason above (archivale property)

Yes, it does have archiavble property on.

hmm

Maybe can you set the cloned tool’s parent to workspace?

I think I found the solution, I think this needs to be a 4 actually. Ima go try that now.
Screenshot 2024-02-11 070226

Still doesnt work for some reason

local currentPart = script.Parent.CurrentBurgerPart

is type of object is this?

1 Like

Oh yeah, I think you did found the solution.

the problem is very simple to fix. All you need to do is:

function onClick(player)
	
	if currentPart.Value == 3 then
		currentPart = 0
		burgerParts.BottomBread.Transparency = 0
		burgerParts.BottomBread.CanCollide = false
		
		burgerParts.BeefPatty.Transparency = 0
		burgerParts.BeefPatty.CanCollide = false

		burgerParts.Cheese.Transparency = 0
		burgerParts.Cheese.CanCollide = false
		
		burgerParts.TopBread.Transparency = 0
		burgerParts.TopBread.CanCollide = false
		
		local clone = tool:Clone()
		clone.Parent = player.Backpack
		
	end
end
2 Likes

Thats the int value that shows what part its on. So bottom bun would 1, beef would be 2 and cheese would be 3 and top bun would be 4 starting at 0. So it adds +1 to every part it adds

the variable “currentPart” is “Instance” not a “value”.
also @ExClow3 said the solution

1 Like

Ohhh I think I forgot to put .Value at the end

Screenshot 2024-02-11 071022
This is my script now, something still not seems to be working. Im just a begginer scripter, so I don’t know much.

Opps I forgot one more thing I forgot the :connect

change that line

currentPart = 0

to

currentPart.Value = 0

Somehow It removed that when I put his script in…

Now it gave me the cheeseburger, but it didnt turn the cheeseburger on the plate invisible