If Statement wont Print [CLOSED]

Just remove the table.find (3-0 characters)

1 Like

image

No, I meant the whole entire thing. The whole if statement only.

local TouchingParts = part:GetTouchingParts()

	if not TouchingParts["Wall"] then
		TouchingWall = false
		print("TouchingWall",TouchingWall)
	else
		TouchingWall = true
		print("TouchingWall",TouchingWall)
	end
1 Like

still printing only once
image

Also, is all of this code in the OnTouched…

1 Like

I put it in OnTouched but it now won’t print when you stop touching the wall, touching the wall it functions fine


part = char.Collider

local function onTouched(otherPart)
local TouchingParts = part:GetTouchingParts()

if not TouchingParts["Wall"] then
	TouchingWall = true
	print("TouchingWall",TouchingWall)
else
	TouchingWall = false
	print("TouchingWall",TouchingWall)
end
end
part.Touched:Connect(onTouched)

You have it backwards, remove the not.

1 Like


the same issue still

I gotta go, if you find out how to solve it. Cool, Sorry for not being able to solve this but in my head, it makes sense.

2 Likes

at this point, I think it’s safe to say that my method is flawed in some way. so I’m going to put this on the shelf, do some research on raycasting and give it a go that way. consider this post closed now. Thank you for the help you have given me, it has helped me learn a few new things about Roblox scripting. Have a great rest of your day/night

2 Likes