Hi- Welcome to the forum flaggy148 !
Here are all important links:
http://lmms.io/forum/viewtopic.php?f=1&t=4740
-A few rules and useful forum instructions
Generally music has no 'rules', not even 'stay in scale' is a 100%'er (But close..!)Are there any rules or tips for making trap melodies
The best thing you can do, is to listen to a lot of the genre you like, and want to work in. Break down the songs, and understand the structure of the genre!
Structure is important! Learn how many beats the best ones uses for various parts, and try to reconstruct some of the melodies you like most. Learn where notes at placed, to give the correct rhythm, that belongs to the genre. Maby you can even find a midi-file of one of the most popular. If so you can really study the usage of notes and chords.
A shorter version - It takes time and effort, and you need to study.