I am trying to make a place where you can make a burger. Pretty much I have the code to cook the patty, and then if you have it then click on the prepare board, you will receive the burger itself.
Code1, this is to display the burger so it looks like you made it.
“ShowCB” is a boolean value inside the prepare board.
local show = game.Workspace.PrepareBurger.showCB
while wait() do
if show then
script.Parent.Transparency = 0
wait(2)
script.Parent.Transparency = 1
else
print("not found")
end
end
Code 2:
CD.MouseClick:Connect(function(player)
print("clicked")
local display = script.Parent.showCB
local CB = player.Backpack:FindFirstChild("CookedBurger")
print("if cb")
if CB then
print("if")
script.Parent.showCB.Value = true
wait(1)
script.Parent.showCB.Value = false
end
end)
local show = game.Workspace.PrepareBurger:WaitForChild("showCB")
show.Changed:Connect(function(NewValue)
if NewValue == true then
script.Parent.Transparency = 0
wait(2)
script.Parent.Transparency = 1
else
print("not found")
end
end)
Code 2 should be:
CD.MouseClick:Connect(function(player)
print("clicked")
local display = script.Parent.showCB
local CB = player.Backpack:FindFirstChild("CookedBurger")
print("if cb")
if CB then
print("if")
display.Value = true
wait(1)
display.showCB.Value = false
end
end)
local show = game.Workspace.PrepareBurger:WaitForChild("showCB")
show.Changed:Connect(function(NewValue)
if NewValue == true then
script.Parent.Transparency = 0
wait(2)
script.Parent.Transparency = 1
else
print("not found")
end
end)
since its an ObjectValue you could connect a .Changed event to check if the value changes like this :
local show = game.Workspace.PrepareBurger.showCB
show.Changed:Connect(function(value)
if show then
script.Parent.Transparency = 0
wait(2)
script.Parent.Transparency = 1
else
print("not found")
end
end)