so only 1 works when you click on the button 1 image changes to it but the other doesn’t.
script:
local button = script.Parent
local images = {player.PlayerGui.ScreenGui.Main.Settings.BackgroundImageSet,
player.PlayerGui.ScreenGui.Main.Games.BackgroundImageGame}
button.MouseButton1Up:Connect(function()
for i,v in ipairs(images) do
v.Image = "rbxassetid://9567131795"
end
end)```
Output says nothing
You could try preloading the image or instead just refer to the paths in two separate variables and set img1.Image and img2.Image as there are only 2 images and this is unnecessary.
Use its functions. That’s pretty much it. Also, not PreloadService, accident. ContentProvider | Roblox Creator Documentation Use ContentProvider as PreloadService is fake and I didn’t mean to say that.
It can, also I think I gave you the soon to be deprecated format, use PreloadAsync. Something like…
local ContentProvider = game:GetService("ContentProvider")
local asset = "rbxassetid://9567131795"
ContentProvider:PreloadAsync(asset)
local button = script.Parent
local images = {player.PlayerGui.ScreenGui.Main.Settings.BackgroundImageSet,
player.PlayerGui.ScreenGui.Main.Games.BackgroundImageGame}
button.MouseButton1Up:Connect(function()
for i,v in ipairs(images) do
v.Image = (asset)
end
end)
I made a quick reproduction of your directory and it seemed to replace both images with the asset, see if this works…
Game:GetService("ContentProvider"):PreloadAsync("http://www.roblox.com/asset/?id=9567131795")
local button = script.Parent
local images = {player.PlayerGui.ScreenGui.Main.Settings.BackgroundImageSet,
player.PlayerGui.ScreenGui.Main.Games.BackgroundImageGame}
button.MouseButton1Up:Connect(function()
for i,v in ipairs(images) do
v.Image = "rbxassetid://9567131795"
end
end)