Ah, I know that, I usually do that, just not this time .
I assume youâve added the return err at the end?
Like I said before, returning within a pcall will make the 2nd tuple your value (err), so youâll have to return err where you return succ.
Additionally, use prints to identify which part of the if statement its returning (Error or Success), this will help us with more information regarding the current issue!
Alright, there are print statements all over the script none of which print.
There seems to be some overcomplication in the provided answers to this post already. To explicitly respond to your initial post: your RemoteFunction handling appears fine. In a studio testing session or live game, there should be no issues. Testing with the output/console may lead to odd behavior because networking is involved but there may be no client/server to handle receiving/delivery.
This implies an issue with field:getInfo()
, as others have mentioned. For the sake of testing your client code, I would recommend commenting out the entire functionâs contents and returning just a simple value. Make sure you receive this value on the client as expected.
Then, move on to looking for issues in the function itself. Admittedly, it is odd that nil
is being returned â at minimum, I would expect an empty table if every HTTP call silently failed, so look into that first. Otherwise, note that every HTTP call has a chance of failure and should be handled with a pcall.
Can you share the Home
script?
function field:GetInfoAsync()
self["Services"] = require(script.Parent.Parent.Services)
self["Stats"] = FunctionStorage:FindFirstChild("Request"):InvokeServer("Statistics")
task.wait()
self["UI"] = script.Parent.Parent.Parent
warn(self["Stats"])
self["UI"].Panel.Pages.Home.Stats.Likes.TextLabel.Text = self["Stats"].Likes
self["UI"].Panel.Pages.Home.Stats.Players.TextLabel.Text = self["Stats"].Visits
self["UI"].Panel.Pages.Home.Stats.Uptime.TextLabel.Text = field:Convert(math.round(workspace.DistributedGameTime))
task.delay(1,function()
self:GetInfoAsync()
end)
end
Edit: Didnt send the whole module as it has a lot of things not related to this topic.
Odd. Since youâre doing some metatable magic, for the sake of testing, I would try running this line either above/below self["Stats"] = FunctionStorage:FindFirstChild("Request"):...
:
print(FunctionStorage:FindFirstChild("Request"):InvokeServer("Statistics"))
Itâs unlikely, but possible, that self["Stats"]
is being overwritten to nil
or is referencing something different before itâs printed.
When I printed it, it did not print nil
instead it printed " ".
Iâll be afk for around 20-60 minutes, if you need more of the script hereâs the file.
(FILE REMOVED)
Edit: Not AFK.
Back, did you figure out why this may be happening?
It seemed it just wasnât being picked up in that script, I changed where it was being picked up from and it workâs fine now.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.