Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I want a GUI to change to another image once the event is fired?

Asked by 4 years ago

So I have a character select GUI and it fires a event and changes the character model I also want the GUI image to change. This is what I have so far.

local event = game.ReplicatedStorage["Choose Goku (S:2)"]

event.OnServerEvent:Connect(function()
    script.Parent.Image = "rbxgameasset://Images/Goku Icon"
end)


So I want the image to change after I receive that the event has fired.

I am new too scripting so any help would be great, thank you.

1 answer

Log in to vote
0
Answered by 4 years ago

I have two solutions for this.

First one:

At this line you have to write the id of the image, not the name:

 script.Parent.Image = "rbxgameasset://Images/Goku Icon"

I can't really help you with the Id, since there are many with the same name. :/

You would probably also have to reload the frame.

Hope this helped you understand roblox asset Id. :)

Second:

You can have another image, and then turn of the visibility of the other and turn on for that image.

script.Parent.Image1.Visibility = false -- Since it's a bool value.

script.Parent.Image2.Visibility = true -- Other Image.

Hope one of these helped you. - Toby

Ad

Answer this question