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

You just need to find where the button is located in the explorer, then reference to that, for example:
image
I would replace StarterGui with player.PlayerGui then do

local button = player.PlayerGui.Buttons.Build.Button
1 Like

Here you are

i referenced the part and nothing happend (sorry for late response)

You would do

local button = script.Parent

Assuming that local script is the one you’re using

1 Like
local player = game.Players.LocalPlayer
local button = script.Parent

button.MouseButton1Up:Connect(function()
   -- add your code here to replace the wallpaper
end)

so this?

local player = game.Players.LocalPlayer
local button = script.Parent

button.MouseButton1Up:Connect(function()
player.PlayerGui.DefaultWallPaper.ChangePic1.Image = “rbxassetid://1011934257”
end)

Yeah


So thats what i needed but it didnt work…

Are there any errors?


ChangePic1 is not a valid member of ScreenGui “Players.SomeOddYtber2.PlayerGui.DefaultWallPaper”

Is that where you set the button variable? If not, replace the .ChangePic1 for :WaitForChild("ChangePic1")

this is the code i got right know

local player = game.Players.LocalPlayer
local button = player.PlayerGui.TextButton

button.MouseButton1Up:Connect(function()
player.PlayerGui.DefaultWallPaper.ImageLabel.Image = “rbxassetid://1011934257”
end)

Replace local button = player.PlayerGui.TextButton for local button = script.Parent

1 Like

Thank you so much! and everyone else who helped

1 Like