handle.Touched:connect(function(hit)
		if not pause2 then
			pause2 = true
			if Mouse.Button1Down then
				if humanoid and hit and not hit:isDescendantOf(person) and Mouse.Button1Down and var.Value == true then
					local target = hit.Parent:WaitForChild("Humanoid", 1)
					var.Value = false
					print("Target variable added.")

Specifically, on the part that says "if humanoid and hit and not hit:isDescencentOf(person) and Mouse.Button1Down and var.Value == true then" the statement is running even when the left click on the mouse isn't clicked. Keep in mind that I'm trying to make a sword.

5 comments

0

"if Mouse.Button1Down then" what?

0

Have you defined mouse previously in the script? It'd probably give us better insight on the issue then.

0

Mouse.Button1Down is an event, not a boolean. It will alwaya be true.

0

Yes, I've defined the mouse.

0

look into repeat loops if you want a loop to run while a value is not true. (This link is old, but,) http://wiki.roblox.com/index.php?title=User:ElectricBlaze/Lectures/Ch2/Repeat_Loops or https://developer.roblox.com/articles/Roblox-Coding-Basics-Loops (Gotta look for repeat/until loops in previous link).