A Question about arrays and such

I was working on this random thing and I can’t seem to print the arrays on my array out.


any help would be appreciated. I used some help for the table setup in general on a pervious post of mine but yeah.

1 Like

Do you get any errors? But on all of the math.random try using tostring(math.random()) this will make sure that its a string and not an integer

try something like this!

list_of_spawns = {
    workspace.Dark,
    workspace.brown,
    workspace.teal,
    workspace.red,
}

randomly_chosen_spawn = list_of_spawns[math.random(1, 4)]

workspace.lime_green.Position = randomly_chosen_spawn.Position

instead of

print(statsAndLevels[1])

try

print(statsAndLevels[player])

that should work

wait really? I thought I had to call the certain index value? Not like I’m trying to be rude, I’m just surprised.

you set the player as the index/key

there isn’t an index/key of 1

Ah sorry just tried it and it doesn’t show the inside values, only this image

When I tried printing it I got a null value, It would print null. No errors however

turn off log mode
in output settings(click on the three dots)

Thats a good idea! I suppose it wouldn’t work for what I’m trying for but Its nice to know of

Thanks! I never knew that there was something like that! Was there a particular reason why log mode is on by default?

you would have to ask another roblox dev or someone who knows about this

I don’t know why it is there by default, I never had it on by default so I don’t know

I think log mode is turned on when you open the output. If you close it and reopen it log mode is automatically turned on. Correct me if I’m wrong.

1 Like

if that was the case, many people would be annoyed by that and complain

it saves when you change it on or off

Ight got it. Thanks for helping out

1 Like