Hello there, my name is Ducksneedhelp. I found a bug today when I was scripting a Coffee Machine.

There is a problem when I was running the code. I was recieving alot of error messages when testing.

Here is one of them.

16:26:52.344 - CoffeeLiquid is not a valid member of UnionOperation "Workspace.Cup".

Here is my code as well!

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local CupTool = ReplicatedStorage:WaitForChild("CupTool")
local StarterPack = game:GetService("StarterPack")
local player = game.Players.LocalPlayer
local ClickForCoffee = script.Parent
local ClickForCoffeeDetector = script.Parent.ClickForCoffeeDetector

local CoffeeLiquid = game.Workspace.Cup.CoffeeLiquid

local Cup = game.Workspace.Cup

script.Parent.ClickForCoffeeDetector.MouseClick:Connect(function()
	
	game.Workspace.Cup.CoffeeLiquid.Size = Vector3.new(0.9, 1, 0.9)
	local CupTool = ReplicatedStorage.CupTool:Clone()
	CupTool.Parent = game.StarterPack
	player:EquipTool(CupTool)
	
	wait(1)
	game.Workspace.Cup.CoffeeLiquid.Size = Vector3.new(0.05, 1, 0.9)
	
end)

-- Start Coffee sizle: 0.05, 1, 0.9
-- End Coffee size: 0.9, 1, 0.9

I don't see what I did wrong in this script. What's the problem I did here?

Kind regards,

Ducksneedhelp

2 comments

0

The error is self-explanatory, is it not? CoffeeLiquid isn't inside of Cup.

0

I tried and for some reason I got the same message. Weird.