Does posting a paper on an online forum establish priority? I have finished writing a paper and am a high school student. Since I'm sure this has no chance of being accepted to arxiv, I want to simply post it on a public forum. (This also has meaning for me because the forum helped me develop in the field where I wrote this paper, and I have friends there.)

My question is: Even if this is a not-that-important paper, imagine hypothetically that someone more prominent (ok, this is highly unrealistic, but just imagine) steals the main result of my paper and publishes it in a renowned journal, or at least somewhere more prestigious than a forum. Would he get credit for the discovery? This seems unlikely since the date I posted it on the forum will show that I came up with it before him.

Note: Although I don't wish to name the exact forum I'm talking about, it's similar to Physics Forums.
If somebody copies your text, then the fact that you posted this text publicly and earlier on the internet (in a location you can't feasibly control, so it won't look like you faked the historical record) will prove that they plagiarized.

It's a little trickier if somebody in inspired by your idea and writes their own paper that doesn't cite yours, since there's no way to distinguish this from independently coming up with the same idea.  It would be unethical to do this, but it could in principle happen.  If you pointed out your prior posting, you would deserve to at least share the credit.  However, people might still downplay your contribution.  "Sure, there was an earlier internet posting outlining the basic idea, but it wasn't nearly as well developed and nobody noticed it since it was posted somewhere obscure.  The real scientific breakthrough occurred when the idea was independently rediscovered, properly understood and worked out, and disseminated to the research community."  You could end up as a footnote, which is still credit but a sort of grudging credit.

I don't expect this will cause any problems.  It's not worrisome unless your ideal is attractive enough to seem worth stealing, while remaining obscure enough that someone could hope to get away with it.  The biggest barrier to intellectual theft is publicity: once enough people know about your idea, anyone who claims to have found it independently will get shot down by someone saying "You may not have known about this, but that's just your own ignorance, since the rest of us know Awesome Academist came up with this idea in 2015.  You should pay more attention to the internet."

Furthermore, if your idea really stays obscure enough that someone could get away with stealing it, then your posting evidently didn't have much impact on the community and you arguably deserve only a footnote's worth of credit.  (People deserve some credit for reaching the goal first, but more credit if they make a bigger contribution by circulating their ideas and influencing the research community.)

I doubt you need to worry about theft, but trying to publish your paper formally could help address this possibility by putting your work before a broader audience.  Anything worth stealing is worth publishing in the first place, so if theft worries you then you should consider publication.