Can't create a value inside dictionary

	local raceResults = {}
	raceResults[raceID] = {}
	events.RaceFinished.OnServerEvent:Once(function(player, raceTime)
		print(raceResults)
		print(raceResults[raceID])
		raceResults[raceID][player.Name] = raceTime
	end)

image
when trying to insert a value inside its not getting added

Try adding the print(raceResults[raceID]) statement after updating the dictionary to see what it says in the Output. Currently, the print statements are only showing what the tables look like before it’s updated to include [player.Name] = raceTime on the last line of code in the function.

Edit: Oh I completely missed the screenshot that showcased the error. Hmmm, where is raceID defined in the script?

what is raceID equals to, you need to let us know what the variable is equal to??

race id is just a number value as shown on the picture in this case its 86

local raceID repeat raceID = math.random(1, 1000) until not table.find(existingRaceIds, raceID)
table.insert(existingRaceIds, raceID)
1 Like

yep tried that. it worked. also i apparently was deleting the raceResults[RaceID]. now its fixed

1 Like

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