GPIO pin with raspberry pi

The value for my float switch connected to gpio pin keep fluctuating. I tried several other pins but the problem is still there. Is there any solution for this problem?

How have you connected the float switch to the pin? In detail please, what is the other end of the switch connected to, is there a pullup resistor fitted etc.
Does it fluctuate whatever the state of the switch or only when it is in one state?
Show us how you have configured the GPIO In node.
How are you seeing that it is fluctuating? Are you doing that using a debug node connected directly to the GPIO node?
Please try to answer all the questions.

Is this an actual float switch in a liquid? If so what is the level of the liquid is it near the level of the switch?

You need to worry about the changes that happen then. I’ll have to pull out my greenhouse flow where I had two float switches in the water tank