What you are currently using is very inefficient. I would just do it like this:
local wallpaper = script.Parent
local RandomImage = math.random(1,2,3,4,5,6,7)
local 1 = "http://www.roblox.com/asset/?id=8365120131"
local 2 = "http://www.roblox.com/asset/?id=12718259853"
local 3 = "http://www.roblox.com/asset/?id=12718249152"
local 4 = "http://www.roblox.com/asset/?id=10261695535"
local 5 = "http://www.roblox.com/asset/?id=9995947618"
local 6 = "http://www.roblox.com/asset/?id=10261695535"
local 7 = "http://www.roblox.com/asset/?id=9995947618"
-- Makes a loop that shows a random picture every 5 seconds
while true do
wallpaper.Image = RandomImage
task.wait(5) -- Task.Wait is better than wait() as its more accurate to a second than Wait()
end