How would I make it when a player touches a part with a tool in their hand the tool will be altered.
I am trying to make it so when you hold an empty coffee pot in your hand and go to a coffee machine, the coffee which has its transparency set to 1 becomes 0 so you can see it, as well as the name being changed.
Any suggestion would be helpful.
Any tool that you're holding is inside of your character. You can use Part.Touched
to detect if a player goes to the machine. A nice example would be this
local function fillcup(cup) if cup.Filled.Value == false then --checks if the cup is filled cup.Filled.Value = true --code to fill cup --maybe a nice fill animation aswell end end part.Touched:Connect(function(parttouching) if game:GetService("Players"):GetPlayerFromCharacter(parttouching.Parent) then --checks if what touched it is a player if parttouching.Parent:FindFirstChild("Cup") then --checks if the player is holding a cup fillcup(parttouching.Parent.Cup) --calls the function to fill the cup end end end)
Where part
is the bit of the coffee machine that you need to touch. Also there is a bool value in the cup called "Filled". And the cup should be named "Cup".