[subject] + 起 + (了 / 到) + [adjective] + 的 + 作用
[subject] + 对 + [noun] + 起 + [adjective] + 作用
[subject] + 不 / 没 + 起作用
起…作用 means "to play a role, to have an effect". 作用 is the noun "effect, role", and 起 is the verb. An adjective between them says how big or what kind. The frame is neutral to written.
对 + noun before 起 says what the effect is on. 起到 stresses that the effect was achieved, and goes with 的作用: 起到了…的作用.
On its own, 起作用 means "to work, to take effect", and its negative is the everyday way to say a remedy or a method did nothing.
English "play a role" doesn't carry over word for word. 玩 is "play" as in games. 扮演…角色 is "play a part" as an actor plays one, and is used of people's roles, not of effects.