I think you still havenât understood it, anyways, with your new code could you try this:
local mapss = ServerStorage:FindFirstChild(chosenMap)
The reason I told you to do this, is because you are assigning the winner.Value to chosenMap variable earlier in your code. So its just the string now, .Value for it is nil.
Please correct me if I am wrong, but would recommend to try that code first.
If what you say is true, and even when it looks for chosenmap it still nil, it means that there isnât a map called Choice2, or it doesnât exist yet
@cakehunterman a model doesnât have a property called .Value , it shouldnât print nil if thereâs a model.
Ahhh I get it now, chosenmap is Choice2 (A StrignValue), you should look for: map since itâs the map name.
Your map value is the coloseseum, therefore, it is nil, since there isnât a map called Choice2 (the StringValueâs name), thereâs a map called colosseum which is the map varaible.
chosenmap is a value, Choice2 is the name.
Edit:
Now I get it even more , it was right in the beginning except for the Maps folder as @WaterJamesPlough said below me, it should have been chosenmap.Value in the beginning, the problem was the parent of the map.
The thing is that you are looking for the map in Server Storage whereas its in a folder named Maps inside Server Storage, after doing the changes @LightningLion58 has said above, you should change that FindFirstChild to this instead I believe:
local mapss = ServerStorage.Maps:FindFirstChild(map)
Itâs true but you are printing the âmodelâ of the map, that doesnât exist, not the chosenmapâs value.
When I said it didnât exist it was because :FindFirstChild returned nil, since it was looking for the Valueâs name and not the value itself.
Could you print the type of the map variable, it seems like it isnât a string. Because other than that I donât see any more errors in the code now.
I am still not sure about this, try using type() instead of typeof(). If it prints string, you know itâs a string, else if it prints model, it might be your map.
Edit: @WaterJamesPlough just asking, why would you look for the map again? Itâs already the mapâs model, thereâs no need to FindFirstChild it again. map might print the name because thatâs the string property of the model.
The reason its being looked for again is because the GUI canât show the names of the maps from ServerStorage so there are folders in Lighting where the map is being chosen and then its being looked for again in ServerStorage (which is probably a primitive way of doing It)
And yeah, you could use the Server Storage folders itself like @LightningLion58 has suggested. Storing stuff in the Lighting Service, isnât really organized in my opinion.
If you want to like make Shared Folders for Client and Server, you could use ReplicatedStorage, so both the Client & Server stuff could be done in less stuff, the current way works too, but this is just better organization and stuff.
The reason I donât have it in ReplicatedStorage and do it this more complicated way is to reduce lag, and I can see it contributing a lot to lag the more maps I add so I did it in ServerStorage to future proof it.