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

How do i make this part hit all the players it touches but not loopkill them?

Asked by 7 years ago
Edited 7 years ago

How do i make the blackhole part hit all the players it touches but not loop the damage so it wont instantly kill the player

touch = true
    blackhole.Touched:connect(function(hit)
        local ehum = hit.Parent:findFirstChild("Humanoid")
        if ehum and ehum ~= hum then
            local target = hit.Parent
        if touch == true then --  If i take this off, it would hit all the players
                touch = false -- but also loop the damage and instantly kill them
        ehum:TakeDamage(35)
        ehum.Sit = true
        wait(0.1)
        target.Torso.Anchored = true
        wait(3)
        target.Torso.Anchored = false

        end

Please help me if you can

0
You're missing an "end", and you never defined "hum". jamesarsenault 192 — 7y

2 answers

Log in to vote
0
Answered by
Tesouro 407 Moderation Voter
7 years ago

I didn't really check your script, but I'll answer your question. There is a 'trick' that is really useful when you are dealing with this kind of event, that fires multiple times.

It's called Debounce, and it simply uses a variable to create a condition when the event is triggered. When the event fires, that variable will be set to false and it will keep it from firing for a while - usually set by time.

Ad
Log in to vote
-1
Answered by 7 years ago

You CAn make a cooldown OF damage using bolean values like:


Bol = true

IF bol = true then Bol = false Print("hay") Wait(3) Bol = true End


Remember that Bol = true needs to be outside of the touched function.

0
That didn't help at all. LittleMarine3 2 — 7y
0
its if bol == true not if bol = true loulou1112 35 — 7y

Answer this question