I am trying to make a coffee system, meaning that I get coffee beans from the machine, then go to the pot and put the beans in, then I can get a cup and touch the pot to put coffee in it.
I'm at the stage of putting beans into the pot however I don't know what is wrong with this script.
local part = script.Parent
local function fillcup(CoffeeBeans)
if CoffeeBeans.Filled.Value == false then -- This value is because the code was intended for filling cups
CoffeeBeans.Filled.Value = true
CoffeeBeans:Destroy()
script.Parent.Coffee.Color = BrickColor.new('Dirt brown') - Changes the color of the water to the color of coffee
script.Parent.Colour.Red.Disabled = false
script.Parent.Colour.Orange.Disabled = false
script.Parent.Colour.Yellow.Disabled = false
script.Parent.Colour.Green.Disabled = false
script.Parent.Colour.Blue.Disabled = false
script.Parent.Colour.Purple.Disabled = false --[[
I have different color cups each with a different script to fill them, that script so far has been working
]]--
end
end
part.Touched:Connect(function(parttouching)
if game:GetService("Players"):GetPlayerFromCharacter(parttouching.Parent) then
if parttouching.Parent:FindFirstChild("CoffeeBeans") then
fillcup(parttouching.Parent.CoffeeBeans)
end
end
end)
The code was originally intended for filling cups and I also got the code from someone else.
To specify what game I'm making, I am making a recreation of the town (Stars Hollow) from a TV show called Gilmore Girls and I'm trying to make it interactive. I also only have a very basic understanding of scripting.

4 comments
The comments aren't on the script, I added them in on here to explain what I know about what the script is doing
Is there an error?
It doesn't say error when the script is run, it just doesn't work
What does it mean when you say the colors and then disabled? Are they scripts?