i took this from Roblox Developer Hub And it say '<eof>' expected near 'local' line 34
-- Set up table to return to any script that requires this module script local PlayerStatManager = {} -- Table to hold player information for the current session local sessionData = {} local AUTOSAVE_INTERVAL = 60 -- Function that other scripts can call to change a player's stats function PlayerStatManager:ChangeStat(player, statName, value) local playerUserId = "Player_" .. player.UserId assert(typeof(sessionData[playerUserId][statName]) == typeof(value), "ChangeStat error: types do not match") if typeof(sessionData[playerUserId][statName]) == "number" then sessionData[playerUserId][statName] = sessionData[playerUserId][statName] + value else sessionData[playerUserId][statName] = value end end -- Function to add player to the "sessionData" table local function setupPlayerData(player) local playerUserId = "Player_" .. player.UserId sessionData[playerUserId] = {Money=0, Experience=0} end -- Connect "setupPlayerData()" function to "PlayerAdded" event game.Players.PlayerAdded:Connect(setupPlayerData) return PlayerStatManager -- Function to add player to the "sessionData" table local function setupPlayerData(player) local playerUserId = "Player_" .. player.UserId local data = playerData:GetAsync(playerUserId) if data then -- Data exists for this player sessionData[playerUserId] = data else -- Data store is working, but no current data for this player sessionData[playerUserId] = {Money=0, Experience=0} end end -- Connect "setupPlayerData()" function to "PlayerAdded" event game.Players.PlayerAdded:Connect(setupPlayerData)
You need to close your PlayerAdded event at line 27. It is expected to end a function after a return.
-- Connect "setupPlayerData()" function to "PlayerAdded" event game.Players.PlayerAdded:Connect(setupPlayerData) return PlayerStatManager end) -- You forgot this end. -- Function to add player to the "sessionData" table
If you have any questions feel free to ask!