It would help to know exactly what kind of switch you mean, since Roblox lets you build all sorts of interactive objects. If you are talking about a switch for lights, for example, you would script a clickable part that toggles the light on and off when touched or clicked.
Tell me a bit more about what you want the switch to control — a door, a light, a platform — and the setup becomes much easier to explain. In general, Roblox switches rely on a script that responds to a player's interaction and changes a property accordingly.