Alexiss169 you could try placing a collider box (hidden) on your edges and do something like : on player collision with (collider) if player animation = idle ; wait 1 sec. , set player animation = "ToooCloseToEdge"... or something along those lines
if your platforms are sprites you could do something similar by placing points on the edges and checking with those. ... just a thought there may be many more ways to do this.