Still have questions? Join our Discord server and get real time help.
Log in to vote
0

# What is wrong with this script? Changing the different things in a model when touched by a tool

Asked by 6 months ago

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.

### 1 answer

Log in to vote
0
Answered by 6 months ago

Maybe the comment that isn't a comment? Line 6

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