Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

[SOLVED] How to make part that alters the appearance of tools?

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.

1 answer

✓ Accepted answer

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".

5 comments

0

Thank you so much, this worked perfectly

0

please accept my answer

0

there should be a green checkmark

0

I don't see a check mark? sorry this is my first time using this platform, where is it?

0

I found it

This discussion is preserved as it was. New answers, comments, and votes are closed.