I’ve been working on some code that has been getting a strange error. I’ve narrowed to done to my leaderstats function causing the issue. I’ve had the function in my script for 3 days now and has working fine until randomly it hasn’t, I haven’t changed anything with it.
My code:
local leaderstats = function()
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local money = Instance.new("IntValue")
money.Name = "Money"
money.Parent = leaderstats
end
leaderstats()
The error:
CorePackages.Packages._Index.roblox_rodux-7f8538c6-2ea111e5.rodux.Store:10: Received error: Caught error in reducer
CoreGui.RobloxGui.Modules.PlayerList.Reducers.PlayerKeys:11: attempt to index nil with ‘Money’ - Client - Store:10
20:24:36.003 Stack Begin - Studio
20:24:36.003 Script ‘CorePackages.Packages._Index.roblox_rodux-7f8538c6-2ea111e5.rodux.Store’, Line 10 - Studio - Store:10
20:24:36.004 Script ‘CorePackages.Packages._Index.roblox_rodux-7f8538c6-2ea111e5.rodux.Store’, Line 152 - function dispatch - Studio - Store:152
20:24:36.004 Script ‘CorePackages.Packages._Index.roblox_rodux-7f8538c6-2ea111e5.rodux.Store’, Line 89 - Studio - Store:89
20:24:36.004 Script ‘CorePackages.Packages._Index.roblox_rodux-7f8538c6-2ea111e5.rodux.thunkMiddleware’, Line 30 - Studio - thunkMiddleware:30
20:24:36.004 Script ‘CorePackages.Packages._Index.roblox_rodux-7f8538c6-2ea111e5.rodux.Store’, Line 98 - Studio - Store:98
20:24:36.004 Script ‘CorePackages.Packages._Index.roblox_roact-rodux.roact-rodux.connect’, Line 149 - Studio - connect:149
20:24:36.005 Script ‘CoreGui.RobloxGui.Modules.PlayerList.Components.Connection.LeaderstatsConnector’, Line 338 - CoreScript - LeaderstatsConnector:338
20:24:36.005 Script ‘CoreGui.RobloxGui.Modules.PlayerList.Components.Connection.LeaderstatsConnector’, Line 261 - CoreScript - LeaderstatsConnector:261
20:24:36.005 Stack End - Studio
20:24:36.006 CorePackages.Packages._Index.roblox_rodux-7f8538c6-2ea111e5.rodux.Store:10: Received error: Caught error in reducer
CoreGui.RobloxGui.Modules.PlayerList.Reducers.PlayerKeys:11: attempt to index nil with ‘Money’ - Client - Store:10
20:24:36.007 Stack Begin - Studio
20:24:36.007 Script ‘CorePackages.Packages._Index.roblox_rodux-7f8538c6-2ea111e5.rodux.Store’, Line 10 - Studio - Store:10
20:24:36.007 Script ‘CorePackages.Packages._Index.roblox_rodux-7f8538c6-2ea111e5.rodux.Store’, Line 152 - function dispatch - Studio - Store:152
20:24:36.007 Script ‘CorePackages.Packages._Index.roblox_rodux-7f8538c6-2ea111e5.rodux.Store’, Line 89 - Studio - Store:89
20:24:36.007 Script ‘CorePackages.Packages._Index.roblox_rodux-7f8538c6-2ea111e5.rodux.thunkMiddleware’, Line 30 - Studio - thunkMiddleware:30
20:24:36.008 Script ‘CorePackages.Packages._Index.roblox_rodux-7f8538c6-2ea111e5.rodux.Store’, Line 98 - Studio - Store:98
20:24:36.008 Script ‘CorePackages.Packages._Index.roblox_roact-rodux.roact-rodux.connect’, Line 149 - Studio - connect:149
20:24:36.008 Script ‘CoreGui.RobloxGui.Modules.PlayerList.Components.Connection.LeaderstatsConnector’, Line 338 - CoreScript - LeaderstatsConnector:338
20:24:36.009 Script ‘CoreGui.RobloxGui.Modules.PlayerList.Components.Connection.LeaderstatsConnector’, Line 214 - CoreScript - LeaderstatsConnector:214
20:24:36.009 Stack End - Studio
I have no idea why I’m getting the error or what the contents of it means. The error also isn’t related to my script in any way, it mentions errors from line numbers that don’t exist in my script. If anyone could please explain to me what this is and how to prevent it, it would be very appreciated.
I didn’t notice that but it still functions the same because its in a PlayerAdded function and ‘player’ was already predefined. Though I’ll still remove the argument for efficiency.
Hm, I’m not certain about this but I felt like Core stuff getting an error is kind of a rare occasion?, Maybe a plugin is causing it perhaps?, because this is very new to me in a way, most of the core error I usually see is just package error.
local players = game:GetService(“Players”)
local replicatedStorage = game:GetService(“ReplicatedStorage”)
local function leaderstats(player)
local leaderstats = Instance.new(“Folder”)
leaderstats.Name = “leaderstats”
leaderstats.Parent = player
local money = Instance.new("IntValue")
money.Name = "Money"
money.Parent = leaderstats
end
players.PlayerAdded:Connect(leaderstats)
Getting exactly the same error
runs script to create leaderstats but errors on close
even tried reloading studio case it was bugged
only started happening this evening
It’s definitely a bug. Before this, the leaderstats and datastore script worked perfectly with no error. Now somehow, it prints out the same long error.
CorePackages.Packages._Index.roblox_rodux-7f8538c6-2ea111e5.rodux.Store:10: Received error: Caught error in reducer
CoreGui.RobloxGui.Modules.PlayerList.Reducers.PlayerKeys:11: attempt to index nil with 'EC'
08:49:57.920 Stack Begin - Studio
08:49:57.920 Script 'CorePackages.Packages._Index.roblox_rodux-7f8538c6-2ea111e5.rodux.Store', Line 10 - Studio - Store:10
08:49:57.921 Script 'CorePackages.Packages._Index.roblox_rodux-7f8538c6-2ea111e5.rodux.Store', Line 152 - function dispatch - Studio - Store:152
08:49:57.921 Script 'CorePackages.Packages._Index.roblox_rodux-7f8538c6-2ea111e5.rodux.Store', Line 89 - Studio - Store:89
08:49:57.921 Script 'CorePackages.Packages._Index.roblox_rodux-7f8538c6-2ea111e5.rodux.thunkMiddleware', Line 30 - Studio - thunkMiddleware:30
08:49:57.921 Script 'CorePackages.Packages._Index.roblox_rodux-7f8538c6-2ea111e5.rodux.Store', Line 98 - Studio - Store:98
08:49:57.922 Script 'CorePackages.Packages._Index.roblox_roact-rodux.roact-rodux.connect', Line 149 - Studio - connect:149
08:49:57.922 Script 'CoreGui.RobloxGui.Modules.PlayerList.Components.Connection.LeaderstatsConnector', Line 338 - CoreScript - LeaderstatsConnector:338
08:49:57.922 Script 'CoreGui.RobloxGui.Modules.PlayerList.Components.Connection.LeaderstatsConnector', Line 261 - CoreScript - LeaderstatsConnector:261
08:49:57.922 Stack End - Studio
Getting the same here. The line in question that throws the error in CoreGui is:
local function createKey(player: Player, primaryStat, stats)
local stat = primaryStat and stats[player.UserId][primaryStat] or nil <-- This one here
return {
name = player.DisplayName:upper(),
stat = stat and tonumber(stat) or stat,
}
end
I wonder if it’s something to do with the argument stats sharing a name with the Roblox Global stats()? I don’t know enough about this. Definitely a Roblox issue though.