Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

PlayerGui not changing image?

I have a script in the workspace. It randomly decides between 1 or 2 and changes a string value to either "1" or "2"

while true do
	
	local math = math.random(1, 2) 
	
	if math == 1 then

		game.ReplicatedStorage.Value.Value = "1"
		
	elseif math == 2 then
		
		game.ReplicatedStorage.Value.Value = "2"
	
	end
end
  

I have this script set to change Playergui's image. Script inside an image button.

while true do

	wait (1)

	if game.ReplicatedStorage.Value.Value == "1" then
		script.Parent.Image = 6946020462

	elseif game.ReplicatedStorage.Value.Value == "2" then
		script.Parent.Image = 6946024491

	end
end


The image just appears blank. Thought? And yes, I named my ScreenGui, StarterGUI

1 answer

✓ Accepted answer

the ID needs to be in a specific format:

while true do

    wait (1)

    if game.ReplicatedStorage.Value.Value == "1" then
        script.Parent.Image = "rbxassetid://6946020462"

    elseif game.ReplicatedStorage.Value.Value == "2" then
        script.Parent.Image = "rbxassetid://6946024491"

    end
end

This discussion is preserved as it was. New answers, comments, and votes are closed.