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

Issue with functions and tools. Kills on touch even though it must be activated?

Asked by 4 years ago
Edited 4 years ago

I have a knife script that works. There's a small problem. When I equip it, the .touched event complete ignore .activated event. This is probably a simple fix, but I don't know how.

EDIT:

I FOUND A SOLUTION. sorry for wasting your time

CODE:

local tf = false

script.Parent.Parent.Equipped:Connect(function()

        script.Parent.Parent.Activated:Connect(function()

                if tf == false then

                    tf = true


                    local anim = script.Parent.Parent.Parent.Humanoid:LoadAnimation(script.Animation)


                    anim:Play()

                        script.Parent.Touched:Connect(function(part)

                            part.Parent:BreakJoints()

                        end)

                    wait(1.5)

                    tf = false

                end     
        end)
end)

1 answer

Log in to vote
0
Answered by 4 years ago

problem fixed:

using the tf value defined earlier, i just checked if it was true, if it was it killed the player sorry

0
make sure you accept your answer or mark the question as solved ProjectInfiniti 192 — 4y
0
You cannot accept your own answer yet alone vote on your answers/questions. JesseSong 3916 — 4y
Ad

Answer this question