Hi Juan, there is nothing special about online experiments in this regard (compared to experiments that you might run within a ‘closed’ lab).
Are you talking about using actual experiment files that someone has created, or just implementing an experiment that someone has decided in the method section of their paper?
In the first case, whoever wrote the code has implicit copyright simply by the act of creating the code. Unless they explicitly bundle the code with a licence allowing use by others, you should ask their permission to use it.
But if you have implemented the experiment yourself, based on a description published by other authors, there is no issue. You now have copyright over this particular code yourself (although no rights over the particular experimental procedure).
That is, an author can’t “own” a series of steps like “show a fixation task, then a peripheral cue, then a target”, etc. They are describing those steps precisely so that you can replicate them in your own studies.
When an author publishes their methods, you can assume they are allowing them to enter the public domain. i.e. they (or more likely their publisher) can have copyright over the manuscript itself, but there is no ownership over the procedures that they describe to carry out an experiment. The only exception to this would be if the methods were explicitly patented but that very seldom happens in psychology (as opposed, say, to biology).
What you do owe the authors is an acknowledgment that you used their ideas to implement your own experiment. This is satisfied by simply citing their work in any resulting manuscript of your own. This is just general intellectual honesty and courtesy and not a legal issue.
In addition to code, beware that authors might choose to retain rights over specific stimuli they create (like photographic images, diagrams) or assessment forms, for which permission or even payment might be needed to use.