ash877
|
  |
| Joined: 18 Feb 2008 |
| Total Posts: 5142 |
|
|
| 07 Nov 2014 11:29 PM |
script.Link.OnServerEvent:connect(function(plr) return (PointsService:GetGamePointBalance(plr)) end)
--This is server sided.
--It should return Player Points balance to a local script which fires the function with pts==script.Parent["PP Manager"].Link:FireServer(game.Players.LocalPlayer.userId)
--What did I do wrong?
|
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 07 Nov 2014 11:30 PM |
Well for one, the first argument for remoteevents/functions are the player themselves, so you don't need to have the blah.userId part.
And for 2, you should be using a remotefunction for this since you are returning something. |
|
|
| Report Abuse |
|
|
ash877
|
  |
| Joined: 18 Feb 2008 |
| Total Posts: 5142 |
|
|
| 07 Nov 2014 11:34 PM |
GetGamePointBalance Returns the total number of points a player has in the current game. Works with server scripts ONLY. Parameters
int userId - The userId of the player.
--Roblox Wiki.
Can you give me an example of returning back the value? Sounds like a lot of work just to return a int value. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 07 Nov 2014 11:35 PM |
return (PointsService:GetGamePointBalance(plr.userId)) pts=script.Parent["PP Manager"].Link:FireServer();
Like I said, use a remote function also. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 07 Nov 2014 11:37 PM |
script.Link.OnServerInvoke = function(plr) return PointsService:GetGamePointBalance(plr.userId); end;
From the client: --It should return Player Points balance to a local script which fires the function with pts=script.Parent["PP Manager"].Link:InvokeServer(); |
|
|
| Report Abuse |
|
|
ash877
|
  |
| Joined: 18 Feb 2008 |
| Total Posts: 5142 |
|
|
| 07 Nov 2014 11:37 PM |
| I wanted to avoid that. Darn. I'll just put everything in a server script then to avoid complexity over transferring little info. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 07 Nov 2014 11:38 PM |
| Why are you avoiding RemoteFunctions |
|
|
| Report Abuse |
|
|
ash877
|
  |
| Joined: 18 Feb 2008 |
| Total Posts: 5142 |
|
|
| 07 Nov 2014 11:41 PM |
| I guess I needed a remote function not an event. Thanks. That simplified everything. |
|
|
| Report Abuse |
|
|
ash877
|
  |
| Joined: 18 Feb 2008 |
| Total Posts: 5142 |
|
|
| 07 Nov 2014 11:42 PM |
| I didn't read up on remote functions. I only used remote events. Now that I know, remote functions could serve me better :3 |
|
|
| Report Abuse |
|
|