handle.Touched:connect(function(hit)
			if Mouse.Button1Down then
						while true do
							wait(0.1)
							if hit.Parent:WaitForChild("Humanoid",1) then
								hit.Parent:WaitForChild("Humanoid",1):TakeDamage(100)
								print("Success!")
							else
								print("Something happened.")
							end
						end
					end
				end)

The script keeps saying that "Humanoid" is a nil value, even though it exists in the target. What do I do to fix this?

5 comments

0

what is that mouse.button1down for?

0

dont think those can be used in serverscripts?

0

this is a LocalScript?

0

Yes, this is a LocalScript. It's a script for a sword.

0

You need to put this in a server script due to Filtering Enabled, I think.