The 'GetDeviceHeight' command returns an integer value and the 'GetSpriteHeight' returns float. I don't know of AGK2 automagically converts the integer value to float so that the resulting calculation is a float value. If it doesn't and does a straight integer division, you might be getting a value of zero.
Try outputting the resulting scale number and see what you get.
A suggestion, since you call the 'GetDeviceHeight' and 'GetDeviceWidth' commands more than once, try making one call and saving the results in a global variable and then use that variable. This reduces the overhead for using the command.
Also, instead of 'background = CreateSprite(LoadImage('images/background.png'))', try this:
back_img = LoadImage('images/background.png')
background = CreateSprite(back_img )
While the example is small, you want to be able to clean up the loaded image in the end, usually. When you use the 'LoadImage' command directly in the 'CreateSprite' command, there is no automagic process that will clean up the loaded image.
Cheers,
Ancient Lady