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

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

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

problem fixed:

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

2 comments

0

make sure you accept your answer or mark the question as solved

0

You cannot accept your own answer yet alone vote on your answers/questions.

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