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

how do i prevent a touched event from firing unless it is activated?

Asked by
Jumbuu 110
8 years ago

Please provide more explanation in your question. If you explain exactly what you are trying to accomplish, it will be much easier to answer your question correctly.
local deb = true
script.Parent.Enabled = true


script.Parent.Blade.Touched:connect(function(hit)
     if not  script.Parent.Enabled then
        return
    end
    script.Parent.Enabled = false

    if equipped and humanoid  and humanoid.Health >=0 and deb == true then

    deb = false

    print(hit.Parent.Name)

    target = hit.Parent:FindFirstChild'Humanoid'

        if target and target.Health >= 0 then

            print(hit.Parent.Name)

            target:TakeDamage(damage.Value)

            end

wait(.8)
    script.Parent.Enabled = true
    deb = true

    end

end)

0
when ever i go up to a dummy, the touched event fires, i want the touch event to fire when it is activated Jumbuu 110 — 8y
0
What do you mean 'when it is activated'? A touched event is activated when you touch something NinjoOnline 1146 — 8y
0
i have another script which swings the sword, i want this script to run when the sword swing script runs and stop when the sword swing script stops Jumbuu 110 — 8y

Answer this question