So basically I am working on a script and I get this error once I use my code:
user_Replay.rbxmx.Replay.Script:121: attempt to index nil with number - Edit - Script:121
So I am wondering how do I fix this?
Code:
local function UpdateRecordings(recording)
getRecordings()
local idToUse = 0
local ID = plugin:GetSetting(IdKey)
if ID then
idToUse = ID
else
idToUse = 0
end
recordings[idToUse] = recording
plugin:SetSetting(IdKey,idToUse + 1) -- update the ID
plugin:SetSetting(key,recordings) -- update recordings
end
So I tried using tonumber but it still not working. It should so I have a feeling it has to do with they key.
So with plugins you can use something called :GetSetting(key, value)
I am not sure if the key has to be a number. Im going to do some more experiments with it