Tripane
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 11432 |
|
|
| 31 Dec 2014 07:38 PM |
I'm trying to save an intvalue and proceed to update it every second, what's wrong here?
SERVER SCRIPT local dst = game:GetService("DataStoreService"):GetDataStore("Save") game.Players.PlayerAdded:connect(function(p) local key = "player number" .. p.userId dst:UpdateAsync(k, function(ov) local nv = ov or 0 p.PlayerGui.MoneyGui.Frame.Money.Value = nv return nv end) end)
LOCAL SCRIPT local dst = game:GetService("DataStoreService"):GetDataStore("Save") local p = game.Players.LocalPlayer local m = script.Parent local id = p.userId local k = "p#"..id
while wait(1) do dst:SetAsync(k, m.Value) end |
|
|
| Report Abuse |
|
|
Tripane
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 11432 |
|
| |
|
Tripane
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 11432 |
|
| |
|
Tripane
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 11432 |
|
| |
|
|
| 31 Dec 2014 08:21 PM |
--SERVER SCRIPT local dst = game:GetService("DataStoreService"):GetDataStore("Save") game.Players.PlayerAdded:connect(function(p) local key = "player number" .. p.userId dst:UpdateAsync(key, function(ov) local nv = ov or 0 p.PlayerGui.MoneyGui.Frame.Money.Value = nv return nv end) end)
|
|
|
| Report Abuse |
|
|
Tripane
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 11432 |
|
|
| 31 Dec 2014 08:22 PM |
| did you even change a thing |
|
|
| Report Abuse |
|
|
| |
|
Tripane
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 11432 |
|
|
| 31 Dec 2014 08:44 PM |
| yes and you literally changed nothing |
|
|
| Report Abuse |
|
|
|
| 31 Dec 2014 08:47 PM |
| I think you want this! I made this button so i did not need to code it again. If you know how to code, you will be able to make anything out of this little model : http://www.roblox.com/item.aspx?setItemId=13221155&avID=287907748 |
|
|
| Report Abuse |
|
|
Waffloid
|
  |
| Joined: 14 Jul 2011 |
| Total Posts: 1606 |
|
|
| 31 Dec 2014 08:53 PM |
| local skripts don't work with datastores |
|
|
| Report Abuse |
|
|
Tripane
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 11432 |
|
|
| 31 Dec 2014 08:56 PM |
@Waffloid
then how do I save the value?????????saufisaubng
But really, how do I then? |
|
|
| Report Abuse |
|
|
Tripane
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 11432 |
|
| |
|
|
| 31 Dec 2014 09:19 PM |
| use RemoteEvents for the client (localscript) to send a signal to the server (server script) to save |
|
|
| Report Abuse |
|
|
Tripane
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 11432 |
|
|
| 31 Dec 2014 09:24 PM |
@theorem
can u explain pls
not used to using remoteevents/functions |
|
|
| Report Abuse |
|
|
Tripane
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 11432 |
|
| |
|
Tripane
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 11432 |
|
| |
|
|
| 01 Jan 2015 03:32 PM |
http://wiki.roblox.com/index.php?title=RemoteFunction_and_RemoteEvent_Tutorial
( ͡ಠ ͜ʖಠ) |
|
|
| Report Abuse |
|
|
Tripane
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 11432 |
|
| |
|
|
| 01 Jan 2015 04:42 PM |
That's literally the source of all knowledge involving RemoteEvents. You didn't think it was helpful because you didn't have the patience to actually look at it.
( ͡ಠ ͜ʖಠ) |
|
|
| Report Abuse |
|
|
Tripane
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 11432 |
|
|
| 01 Jan 2015 04:45 PM |
I said it wasn't helpful because I've already looked at it before and don't know how to apply it to my problem
Like, what's a tuple? Can it hold the player, so I can tell the serverscript to save their value? I have no idea how to use them... |
|
|
| Report Abuse |
|
|
|
| 01 Jan 2015 06:37 PM |
Server Script:
local event1 = Instance.new("RemoteEvent") event1.Parent = game.Workspace event1.Name = "MyServerEvent1" event1.OnServerEvent:connect(function(player, arguments) print(player.Name .. " says: " .. arguments) end)
Local Script:
game.Workspace.MyServerEvent1:FireServer("Hello")
Output: "LeitrisArcade says Hello"
( ͡ಠ ͜ʖಠ) |
|
|
| Report Abuse |
|
|
Tripane
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 11432 |
|
|
| 02 Jan 2015 12:52 PM |
Okay, here's what I have:
SERVERSCRIPT local dst = game:GetService("DataStoreService"):GetDataStore("Save") game.Players.PlayerAdded:connect(function(p) script.LoadEvent.OnServerEvent:connect(function(pl, mn) local k = "player number" .. pl.userId dst:UpdateAsync(k, function(o) local n = o or 0 p.PlayerGui.MoneyGui.Frame.Money.Value = n return n end) end) end)
LOCALSCRIPT local p = game.Players.LocalPlayer local m = script.Parent --The money value
while wait(20) do game.ServerScriptService.ServerScript.DataLoad.LoadEvent:FireServer(p, m) end
But the value still does not load when the player respawns, plus I get no output |
|
|
| Report Abuse |
|
|
Tripane
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 11432 |
|
| |
|
Tripane
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 11432 |
|
| |
|
Tripane
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 11432 |
|
| |
|