Return returns nil

Hello, I’m making an event that returns a value from a module script. I have a module script inside server storage that holds data for the player. From there a server script retrieves the data and returns it to the client. The only problem is when I return it even though it does exist it returns nil.
Scripts:

local value = RetrieveData:FireServer("value1", "value2")
print(value) -- nil
local function onEvent(player, dataType, dataName)
	local playerData = data:Return(player)
	if playerData[dataType] and playerData[dataType][dataName] then
		local value = playerData[dataType][dataName].Value
		print(value) -- 100
		return tonumber(value)
	end
end

I know that since it’s a module script on the server it doesn’t exist for the client, but I’m returning a number and that should exist I think.

Thank you.

You can’t return values from RemoteEvents; you need RemoteFunctions to do that

3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.