So, I'm trying to make it so if the plunger hits the water it turns it to cyan. I tried using normal detection functions like touch functions and hit functions, but nothing is working. Here is what I have so far:
local water = script.Parent local handle = game.StarterPack.Plunger.Handle local colliding = false water.Touched:connect(function(hit) colliding = true print(hit) if hit == handle then water.BrickColor = BrickColor.new("Cyan") end end) water.TouchEnded:connect(function(hit) if hit == handle then colliding = false end end)
As you can see, if the handle hits the water it's suppose to change the color, and it's never happened. While it's "colliding", the output doesn't print "Handle", only my body parts (when I touch the water). So I don't know if this is a bug or not, but it doesn't detect the handle of the tool. Help if you can please.
The problem is that you're trying to detect if the handle that collided is the one at game.StarterPack
, but it only gets cloned from there, so you need to check if its the correct tool that collided with it:
local water = script.Parent local colliding = false water.Touched:connect(function(hit) colliding = true print(hit) if hit.Parent.Name == "Plunger" and hit.Parent:IsA("Tool") then -- cheks if is a tool and is named "Plunger" water.BrickColor = BrickColor.new("Cyan") end end) water.TouchEnded:connect(function(hit) if hit.Parent.Name == "Plunger" and hit.Parent:IsA("Tool") then -- cheks if is a tool and is named "Plunger" colliding = false end end)