Remote function always returning nil

Server:

game:GetService("ReplicatedStorage"):WaitForChild("FunctionStorage"):WaitForChild("Request").OnServerInvoke = function(player,Request)
    warn(player,Request)
    if Request == "Statistics" then
        local Info = field:getInfo()
        warn("Getting Info!")
        return Info
    end
end

So it never warns player or request. I ran this line of code in the out put at it did show that it was being invoked

game:GetService("ReplicatedStorage"):WaitForChild("FunctionStorage"):WaitForChild("Request").OnServerInvoke = function(player,Request) warn(player,Request) end

Warning: zeyan200_gotdeleted Statistics

But the returned value is always nil

Client:

self["Stats"] = FunctionStorage:FindFirstChild("Request"):InvokeServer("Statistics")
    
    task.wait()
    
    if self["Stats"] == nil then
        warn("Stats | Nil ", self["Stats"])
        task.wait(0.8)
        if self["Stats"] == nil then
            field:GetInfoAsync()
        end
    end
4 Likes

Try print(Info) before return Info to see if ‘Info’ is a non-nil value.

3 Likes

Ok but warn("Getting Info!") doesnt actually run so I dont think that this will.

1 Like

Unfortunately It did not print at all.

FunctionStorage:FindFirstChild
You may need to change this to ‘WaitForChild’.

3 Likes

That wouldn’t do much due to this line being at the top of both of those script’s.

Using WaitForChild and declaring it as a variable would be better but that’s not the issue rn. What’s the field info thing?

1 Like

The field:getInfo() Function is this

function field:getInfo()
	local Votes
	local Details
	local Info = MarketplaceService:GetProductInfo(game.PlaceId)


		Votes = HttpService:JSONDecode(HttpService:GetAsync("https://games.roproxy.com/v1/games/"..game.GameId.."/votes"))
		Details = HttpService:JSONDecode(HttpService:GetAsync(`https://games.roproxy.com/v1/games?universeIds={game.GameId}`))

	return {
		["Thumbnail"] = "rbxassetid://".. Info.IconImageAssetId,

		["Name"] = Details.name or "N/A",

		["Description"] = Details.description,

		-- Stats

		["Active"] = Details.playing or "N/A",
		["Visits"] = Details.visits or 0,
		["Favorites"] = Details.favoritedCount or "N/A",


		["Creator"] = Details["creator"],
		["Updated"] = Info.Updated,
		["Created"] = Info.Created,

		-- Votes

		["Likes"] = Votes.upVotes or "N/A",
		["Dislikes"] = Votes.downVotes or "N/A",
	}

end

Edit: And like I said in my post above there is no need for a WaitForChild()

Well there’s no need for it because you used a less efficient method for it. Is your script in somewhere other than server script service?

For the server its here:
image

For the Client its here:
image

1 Like

What is this showing as output?

1 Like

It’s not printing for them at all

1 Like

It is getting outputted here on the client side

Is analytic service being required? That’s the only reason I can think of it not working


Yes it is being required

I don’t have my studio open, its updating as usual, but don’t you need a :Connect in here somewhere, or am I thinking of something totally different?

Connect would be for ‘RemoteEvent’ instances, they are using a ‘RemoteFunction’ instance.

3 Likes

You don’t use :Connect when it comes to remote and bindable functions.

And the services script is also getting required?

Sorry, my bad. Once my studio loads, I’ll copy your code, and the remote events and see if I can help figure it out.

1 Like