Make it so when someone clicks a GUI Button it changes an image on a GUI (Server-Sided.)

Hi, I’m wondering how I could make it so you can click an ImageButton that changes another ImageLabel to an image, and also changes a String Value (Such as if you click BuildingTools, it changes the image to BuildingTools and also changes the Value to BuildingTools).

So far I already tried this and it worked for one image only, but it froze my studio! I asked one of my friends, and he was pretty confused! (even though he was an advanced scripter).


The freezing of Roblox Studio probably isn’t related to this. You could use a RemoteEvent. Have it such that when the button is clicked, you fire the event. Something like:

local RPS = game:GetService("ReplicatedStorage")
local Remote = RPS:WaitForChild("NAME_OF_YOUR_EVENT")

    Remote:FireServer(info) --Define info, if you need to pass information over to the server, for example the player's name.

Then have a server script, that looks something like this:

local RPS = game:GetService("ReplicatedStorage")
local Remote = RPS:WaitForChild("NAME_OF_YOUR_EVENT")

Remote.OnServerEvent:Connect(function(player,info) --The first parameter will be the player who fired it, and the second one would be the first parameter of the LocalScript.
    game.Workspace.Part.ImageLabel.Image = info --That is if the info is the TextureId, if not just replace it with anything else you want.

It works, but It’s not working on the server side? How do I fix this?

@DevOkami ???

You did create the event, right? Let me see your code.

Everything (as far as I know) holds up.

Any errors in the output?


Hmm. I’m not sure if this means anything.

Also, how I know it’s not showing on server is when I switch it in Studio from Client to server the image disappears:

Oh! That’s because it doesn’t change the StarterGui. It does change the image.

Also, you called it BuildingToolsOne, not just BuildingTools. Thats the infinite yield problem you got there.

Actually it’s not. BuildingToolsOne is the name of the RemoteEvent.

Yeah that’s what I’m saying. The infinite yield is waiting for an item called “BuildingTools” while the actual name is BuildingToolsOne. What is confusing is that in the scripts he provided, they are called correctly. Unless there is more that we are not seeing. Not too sure about this.

So… How would I go about changing the StarterGui? I’m not sure what you mean by that?

The Scripts and items are called Building Tools, while the Remote Event and all of the script define ‘BuildingToolsOne’. So wdym?

You want it to change on everyone elses screen when they join?

Use this code for the server.
script.Parent.Image = "image id, please embed your code instead of posting pictures" = "image id, please embed your code instead of posting pictures"
1 Like

Yes, I need it on everybody’s screen.

I’ll try it now, thanks.

Okay. Look at my edit also.


Uh, no. I said the server code.

Oh! You mean the regular script, not the LocalScript?

1 Like