Creating no place area for placing stuff

I am working on Tower Defense game. But I cannot understand why it keeps saying true instead of false when it detects NoPlacePart. It does detect but doesn’t return false. So how I could fix that?

if Unit:FindFirstChild("Left Leg") then
	for _, v in pairs(GetTouchingParts(Unit:WaitForChild("Left Leg"))) do
		if v == "NoPlacePart" then
			canPlace = false
			break
		else
			canPlace = true
		end
		print(v)
	end
end
print(canPlace) -- canPlace -> true, instead of canPlace -> false.

That part of script is placed in RunService.RenderStepped.

Note: GetTouchingParts is my function

1 Like

Change

if v == "NoPlacePart" then

to

if v.Name == "NoPlacePart" then

4 Likes

Simple mistake, I forgot that one. Thanks!