Help with ProfileService

Okay, so I have a ServerScript with a function

function getDataValue(Player, Value)
local Profile = Profiles[Player]
if not Profile then return end

return Profile.Data[Value]

end

GetData.OnServerInvoke = getDataValue

and this LocalScript
local Remotes = game:GetService(“ReplicatedStorage”):WaitForChild(“Remotes”)
task.wait(5)
local Money = Remotes.GetDataValue:InvokeServer(game.Players.LocalPlayer, “Money”)
script.Parent.Text = tostring(Money)

The thing is, I don’t know how to get the player’s money. If I do Profile.Data.Money with the player’s profile, it returns the right value, but in the LocalScript, the value is just nil, so how do I get a specific data value from a LocalScript?

You just need to return the Profile.Data.Money to the client? Does it actually return as nil from the server?

There’s also another option using ReplicaService to automatically replicate certain ProfileService’s profile to the requested client.
ReplicaService

I need to return Profile.Data[Value] to the client, because I want to have a function to get my data-values. I don’t want to have a function for every value and then return e.g Profile.Data.Money

What’s your server script? (30 letters limit)

https://paste.gg/p/anonymous/03ce5af976be44c79bc088158b7994b3

Nvm, I found a solution, but thanks for taking your time to answer to my problem!

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