The problem is on line 10, when I try to get the name of the part. Output says that part is a nil value.
local tool = script.Parent
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
script.Parent.Activated:connect(function()
if mouse.Target.Name == "Water" then
local ray = Ray.new(tool.Handle.Position, mouse.Target.Position)
local part, point = workspace:FindPartOnRay(ray)
if part.Name == "Water" then
print "success"
end
end
end)

6 comments
alright, lemme get code stuff ready
Line 11. use print("success")
hmm that didn't work, lemme try something else
Make sure to check if the Ray anything, otherwise it will return nil.
Btw, for your script, it's taking the Target position and multiplying by 300. Say the vector3 was 1,1,1, it will become 300,300,300. That's a really big different. The Ray bit should be (End - Start).Unit * 300
"Make sure to check if the Ray anything, otherwise it will return nil." What does that mean? Also, I got rid of the 300 thing. I want to put a limit on how far it would go, but I can do that after I get the part.