Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-2

How can I simplify touching?

Asked by
Zerio920 285 Moderation Voter
10 years ago

I have this:

water = script.Parent

water.Touched:connect(function(hit)
    if hit.Name == ("Sponge") then
        hit.Sound:Play()
        water.TouchEnded:connect(function(hit)
            if hit.Name == ("Sponge") then
                hit.Sound:Play()
                wait()
            end
        end)
    end
end)

How can I simplify this so I won't have to keep redefining "hit"?

0
What? You don't.. it's defined from the beginning, it's the parameter for your touched event. This is as simple as it gets. Goulstem 8144 — 10y

Answer this question