Script breaks after reset

Hi all, after the player dies/resets the images that are previously visible in my GUI go back to being visible.

game.Players.PlayerAdded:Connect(function(player)
	local Gui = player.PlayerGui
	local images = Gui:WaitForChild("FoundClothing").Clothingframe:FindFirstChild("Scroll"):GetChildren()
	local valuelist = player:WaitForChild("PlayerData"):FindFirstChild("SaveImage"):GetChildren()
	for i=1,#images do
		for x=1,#valuelist do
			local image = images[i]
			local value = valuelist[x]
			if image.Name == value.Name then
				image.Visible = true
				--Done, you beauty!!!!!		
			end
		end
	end
	
end)

Thanks!

1 Like

Couldn’t you just set the ResetOnSpawn property to false for your Gui’s?

4 Likes