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

How to make Specific Debounce?

Asked by 8 years ago

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?

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? funyun 958 — 8y
0
Certain parts will be named certain things. Mentalcase 35 — 8y

1 answer

Log in to vote
1
Answered by
funyun 958 Moderation Voter
8 years ago

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)
1
Appreciated! Mentalcase 35 — 8y
0
You can do that or you can make a anonymous functions. I think it is easier to use for your scripts. duckyo01 120 — 8y
0
I'm not using anonymous functions because I don't want to get these guys confused. funyun 958 — 8y
Ad

Answer this question