Presenting my last tech build..
The Coffee Machine!
100% made by me, this one is not just a common copied model, but a machine completely rescripted!
say goodbye to these transparent spill coffee machines you see at ironcafes or somewhere which looked like it was spilling out of the mug, because this one has astonishing features!
Anti-Double mugs this means the machine will make the "mug" spill in the machine if you already have a mug, consuming or not. this is achieved by detecting the mug in the player backpack and workspace character, just like the morphs do. it was hard to find out how could i detect the mug in the character from the surfaceGui, until i thought of a way : get the LocalPlayer's name and then FindFirstChild(name) in the workspace
local player = game.Players.LocalPlayer.Name
local char = game.Workspace:FindFirstChild(player)
Mug foam Option if you want a classic coffee without that foam, you can just disable the foam In the screen. that is achieved using if statements and a boolean value for the foam in the machine and mug.
Coffee color and preview besides the foam, you can also change the color of the coffee, from the normal brown to the weird blue! this mechanic is achieved using values for the drink (coffee) and the foam.
script.Parent.Parent.Parent.Drink.Value = script.Parent.Parent.Parent.Liquid1.Value
above is the script of one of the buttons of the coffee color as you see in the images. when clicked, will change the value of the chosen color to the value of the liquid value, which is the color value of the option.
local cof = game.DataStorage.Mug:Clone()
cof.Parent = game.Players.LocalPlayer.Backpack
cof.Liquid1-8.BrickColor = script.Parent.Drink.Value
this is a part of the main script which resides in the ready button of the surfaceGUI. you can see the script clones the mug tool from the DataStorage service and parents it to the backpack of the localPlayer, then it recolors the liquid inside the tool to the color of the drink value. pretty neat, isn't it?
the Preview part bricks are recolored using the same technique as mentioned above.
and that's all, folks!