Image not highlighting if player found emerald

Hello DevForum, I’m gonna get straight to the point. I’m trying to make it so when you collect an emerald it highlights an image of the emerald. but it will not do that.

local player = game.Players.LocalPlayer
local list = game.ReplicatedStorage:FindFirstChild("ChaosEmeralds")
local collectedFolder = player.CollectedEmeralds

function highlightImage(emerald)
	game.Players.LocalPlayer.PlayerGui:FindFirstChild("emeralds"):FindFirstChild("main"):FindFirstChild(emerald).ImageColor3 = Color3.new(1, 1, 1)
end

for i, emerald in pairs(list:GetChildren()) do
	if collectedFolder:FindFirstChild(emerald.Name) then
		highlightImage(emerald.Name)
	end
end

basically its scanning the folder that has the collected emerald values.
if you need more details ask.

From what I know you are not running the for loop, try adding a while loop and instead of a for loop run a GetDescendants() function

2 Likes

Fast fix, that was pretty easy. Thanks man

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.