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

ImageLabel does not load in when switched In-game?

Hi, I've been trying to have this imagelabel switch images every .5 seconds, but when I try to switch it in a local script in game, it just doesn't load even though it displays the new url in game.

code (inside a localscript):

while true do
	workspace.Values.testbool.Value = true
	game.StarterGui.loadout.primary.primaryImg.Image = "rbxassetid://4912923363"
	print("whoo")
	wait(.5)
	workspace.Values.testbool.Value = false
	game.StarterGui.loadout.primary.primaryImg.Image = "rbxassetid://145303048"
	print("yay")
	wait(.5)
end

1 comment

0

The script seems perfectly fine. Maybe your issue is the place of the LocalScript? They don't work in the Workspace unless they are in your player model.

1 answer

✓ Accepted answer

you can't put localscripts in workspace, put them in startergui, and you can't change the image in startergui, you have to change it in playergui because the guis from startergui are cloned to playergui, so try this

while true do
	workspace.Values.testbool.Value = true
	for _,v in ipairs(game.Players:GetPlayers()) do
		if v:FindFirstChild("PlayerGui") then
			v.PlayerGui.loadout.primary.primaryImg.Image = "rbxassetid://4912923363"
		end
	end
	print("whoo")
	wait(.5)
	workspace.Values.testbool.Value = false
	for _,v in ipairs(game.Players:GetPlayers()) do
		if v.PlayerGui.loadout.primary:FindFirstChild("primaryImg") then
			v.PlayerGui.loadout.primary.primaryImg.Image = "rbxassetid://145303048";
		end
	end;
	print("yay")
	wait(.5)
end

1 comment

0

works! tysm!

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