Can't get value from table, got nil

Greetings, I have a problem with tables, when I try to get a value from a table it returns 0 (I call it as : table[‘Coins’])

main Script :

			playerData = {
				['Coins'] = 250,
				['Gems'] = 0,
				['Donate'] = 0,
				['Lvl'] = 0,
				['Exp'] = 0,
				['SelectedTowers'] = {'Shooter'},
				['OwnedTowers'] = {'Shooter'},
				['Codes'] = {}
			}
               
              Events.loadValues:Fire(Player, PlayerData['Coins'], PlayerData['Donate'], PlayerData['Gems'],)

Secound script :

Events.loadValues.Event:Connect(function(Player : Player, a, b, c)
	RunService.RenderStepped:Connect(function()
		local PlayerGui = Player.PlayerGui

		local Data = DataStore:GetAsync(Player.UserId)

		local LobbyGui = PlayerGui.LobbyGui
		local t = LobbyGui.Menu.Toolbar

		local v = t.Values

		v.Coins.Amount.Text = a
		v.Donate.Amount.Text = b
		v.Gems.Amount.Text = c
	end)
end)
1 Like

hi, can you provide more context? what is going wrong? are there any errors? more of the script?

youre naming the table playerData with lowercase p and then you use this:

with capital P is that the problem

1 Like

I changed it, but nothing happened

is it still erroring and is it from that line specifically

why are you running GetAsync in a RenderStepped loop

2 Likes

Nwm, i fixed that. I think i make mistake in a table

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