String is automatically converted to a integer [SOLVED]

  1. What do you want to achieve? I want to get a property of a part.

  2. What is the issue? After I do object[property] it returns a number.

  3. What solutions have you tried so far? I tried converting it to a string but it didn’t work.

for _, v in pairs(clonedNotification:GetDescendants()) do
    for i, data in pairs(transparencyData) do -- transparencyData is a dictionary
        if i == v.Name then
            print(data) -- returns the correct vlaue
            local TransparencyProperty = v[data]
            print(type(TransparencyProperty)) -- returns a number
            print(TransparencyProperty) -- returns property as a number
            print(tostring(TransparencyProperty)) -- returns "1"
        end
    end
end

Someone please help!

1 Like

i think i may or may not be wrong but it is returning a number because you tried

if i == v.Name then

transparencyData is a dictionary so i isn’t a number.

also i made a mistake you can take a look at the code again

So it returns a number, but what is it supposed to return if not a number?

I want to tween v’s TransparencyProperty

I found my error and resolved it.