Accessing a Table with value passed from .Changed function

Hi! so im trying to make a “Ring system” like in Eternals Tower of Hell and im trying to make it so when you switch the ring the name changes, Im doing this by using a table that holds the name of each ring and I don’t know how to access the string from the table with this current method… I could really use some assistance!

Table:

local Rings = 
	{
		Ring1 = "Exhibition A",
		Ring2 = "Exhibition B"
	}

Function:

CurrentRing.Changed:Connect(function(value)
	if defaultCam then
		print(Rings[value])
		TweenService:Create(defaultCam,Info,{CFrame = Cameras:FindFirstChild("cam"..value).CFrame}):Play()
		TitleText.Text = Rings[value]
	end
end)

What type of instance is CurrentRing?

Current Ring is an IntValue

char limit eufhsdipfuasdfg

That’s the issue then, the “value” parameter is returning the new number of the IntValue, so 2 for example. When the script goes to check the table for the index of 2 it only finds Ring1 and Ring2 instead of just the plain number 1 or 2.

The easiest way to fix this would just be by changing the table:

local Rings = 
	{
		[1] = "Exhibition A",
		[2] = "Exhibition B"
	}

This should work

1 Like

Actual life saver, Thank you so much!!

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