Issue with Clicking on a button ui to change a image ui

I’m making a windows XP game and I cant get the background of the wallpaper to change this is my code

game.StarterGui.DefaultWallPaper.ImageLabel.Image = “1011934257”

this is a local script as well

(Btw im not a good scripter)

1 Like

You don’t reference StarterGui, you have to reference the player’s Gui:

local player = game.Players.LocalPlayer
player.PlayerGui.DefaultWallPaper.ImageLabel.Image = "rbxassetid://1011934257"
1 Like

thanks also it put it on on its own without clicking it

1 Like

You have to run it once the player clicked the button:

local player = game.Players.LocalPlayer
local button = ... -- replace with whatever the button is

button.MouseButton1Up:Connect(function()
    player.PlayerGui.DefaultWallPaper.ImageLabel.Image = "rbxassetid://1011934257"
end)
1 Like

would it be this

local button = “blah blah” – replace with whatever the button is

What do you mean?


Edit: “Example” or Example with our with out “”

1 Like

No, you don’t include speech marks when referencing something for a variable

Not with . at least

without the speech marks it underlines red

Can you send that line?


The ChangePic1 Has red underline

local button = ChangePic1 – replace with whatever the button is

You need to replace that and reference the image / text button. For example

local button = player.PlayerGui.TextButton

replaced it and it did nothing when i pressed the button

Did you reference it correctly?

I had it

local button = player.PlayerGui.TextButton

You need to reference it properly, that was just an example

referencing by naming of what it is

Can you please send a screenshot of your ScreenGui in the explorer?