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

using a value to see how many visible image labels?

I am currently making a sort of SCP Game in and I am currently stuck on a part of code in which I hope you guys can help me with.

So, I have this, a blink bar system.

I've already done the core code in which per sound it goes down by one, here.

I basically want to get the number on Blink (x/20) and choose how many visible image labels there should be (also out of 20).

There are twenty of these image labels and I want only a certain visible at a time.

If the blink is on 15, only 15 will show. If the blink is on 2, only 2 will show - and so on.

But I wasn't sure where to start, I'm hoping you guys could help me out?

(I feel like it's something to do with :GetChildren() and counting the children with #numberOfChildren, but I wasn't very sure).

1 answer

✓ Accepted answer

Assuming you're trying to have images that bind with the seconds, you can give each a name 1-20. Then you can do:

for i,image in pairs(LOCATION_OF_IMAGES) do
	if image:IsA("ImageLabel") then
		if tostring(Assets.Stats.Blink.Value) == image.Name then
			-- Do something here with the specific image
			-- EXAMPLE: image.Visible = true
		else
			-- Reset the image back to its original state
		end
	end
end

2 comments

0

Also note that they should be ImageLabels. If they are something else, please replace IsA("ImageLabel") with the type of the object.

0

Thank you.

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