Anyone know why it it can't get the value of toolsdata[v.Name]?
game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:wait()
local keyId = plr.UserId.."-Tools"
local tooldata = toolsDataStore:GetAsync(keyId)
if tooldata then
print("found data")
for i,v in pairs(serverStorage:GetChildren()) do
print(v.Name)
print(tooldata[v.Name]) -- prints nil
if v.Name == tooldata[v.Name] then
wait(0.5)
print(v.Name.." is the same as "..tooldata[i])
local tool = v:Clone()
tool.Parent = plr.Backpack
end
end
end
end)

1 comment
I would also like to add that it works if i put in the index instead of v so for example tooldata[i], but comparing that to v.Name doesn't get the result I want.