I'm trying to make it so this tool detects if it's hitting a certain object only.
local tool = script.Parent local debounce = false local mowevent = game.ReplicatedStorage.Remote.Mow local pwr = 0.1 tool.Activated:Connect(function() if not debounce then debounce = true mowevent:FireServer(pwr) workspace.Lawn.Grass.Touched:connect(function(tool) print("hit") end) wait(1) debounce = false end end)
Is there a better way to do this?
Grass
script.Parent.Touched:Connect(function(part) if part.Parent.Name == "Mower" then -- if it’s a lawn mower -- Do code end end)