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

How to make Specific Debounce?

Is there a way to specify what blocks can and can't initiate a Debounce reaction to a block? Example: I have a pool of lava in front of me that will melt people upon debounce, Players go in and get melted, however if I throws blocks in, the blocks wont melt. Is this a possible thing, and if so how do I go about doing so?

2 comments

0

How do you propose to differentiate the parts that will melt from the parts that won't? Will certain parts be named certain things? Do you just want people to melt, and nothing else?

0

Certain parts will be named certain things.

1 answer

✓ Accepted answer

For several parts having one name:

debounce = false
name = "" --Use the name of the parts that won't be melted

function onTouched(part)
    --If the function is running or if the part's name is the name we're excluding, we don't do anything.
    if debounce or part.Name == name then return end
    --stuff
    debounce = true --Let the function run again.
end

script.Parent.Touched:connect(onTouched)

3 comments

1

Appreciated!

0

You can do that or you can make a anonymous functions. I think it is easier to use for your scripts.

0

I'm not using anonymous functions because I don't want to get these guys confused.

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