local L=game:GetService("\080\108\097\121\101\114\115")local p=require(script.Parent:WaitForChild("\112\108\097\121\101\114\083\116\097\116\101"))return function(A,C)A=A or{}if C.player then local K={}for L,f in pairs(L:GetPlayers())do local h="\112\108\097\121\101\114\095"..f.UserId if f==C.player then K[h]=p(A[h],C)else K[h]=A[h]end end return K end return A end
local Players = game:GetService("Players")
local playerState = require(script.Parent:WaitForChild("playerState"))

return (function(state,action)
    state = state or {}

    if action.player then
        local newPlayerState = {}
        for _,player in pairs(Players:GetPlayers()) do
            local playerKey = "player_"..player.UserId
            if player == action.player then
                newPlayerState[playerKey] = playerState(state[playerKey], action)
            else
                newPlayerState[playerKey] = state[playerKey]
            end
        end
        return newPlayerState
    end

    return state
end)