generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: DataStores

Previous Thread :: Next Thread 
Tripane is not online. 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 is not online. Tripane
Joined: 03 Jun 2011
Total Posts: 11432
31 Dec 2014 07:52 PM



b
Report Abuse
Tripane is not online. Tripane
Joined: 03 Jun 2011
Total Posts: 11432
31 Dec 2014 07:57 PM
r u srs m8
Report Abuse
Tripane is not online. Tripane
Joined: 03 Jun 2011
Total Posts: 11432
31 Dec 2014 08:20 PM
omf
Report Abuse
masterblokz is not online. masterblokz
Joined: 17 Nov 2010
Total Posts: 9517
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 is not online. Tripane
Joined: 03 Jun 2011
Total Posts: 11432
31 Dec 2014 08:22 PM
did you even change a thing
Report Abuse
masterblokz is not online. masterblokz
Joined: 17 Nov 2010
Total Posts: 9517
31 Dec 2014 08:23 PM
did you even try it
Report Abuse
Tripane is not online. Tripane
Joined: 03 Jun 2011
Total Posts: 11432
31 Dec 2014 08:44 PM
yes and you literally changed nothing
Report Abuse
louisphilippe2 is not online. louisphilippe2
Joined: 30 Apr 2011
Total Posts: 298
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 is not online. Waffloid
Joined: 14 Jul 2011
Total Posts: 1606
31 Dec 2014 08:53 PM
local skripts don't work with datastores
Report Abuse
Tripane is not online. 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 is not online. Tripane
Joined: 03 Jun 2011
Total Posts: 11432
31 Dec 2014 09:06 PM
b
Report Abuse
PlanarTheorem is not online. PlanarTheorem
Joined: 02 Jan 2008
Total Posts: 147
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 is not online. 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 is not online. Tripane
Joined: 03 Jun 2011
Total Posts: 11432
31 Dec 2014 09:45 PM
b
Report Abuse
Tripane is not online. Tripane
Joined: 03 Jun 2011
Total Posts: 11432
01 Jan 2015 02:54 PM
b
Report Abuse
LeitrisArcade is not online. LeitrisArcade
Joined: 15 May 2010
Total Posts: 2127
01 Jan 2015 03:32 PM
http://wiki.roblox.com/index.php?title=RemoteFunction_and_RemoteEvent_Tutorial

( ͡ಠ ͜ʖಠ)
Report Abuse
Tripane is not online. Tripane
Joined: 03 Jun 2011
Total Posts: 11432
01 Jan 2015 04:40 PM
that didn't help at all
Report Abuse
LeitrisArcade is not online. LeitrisArcade
Joined: 15 May 2010
Total Posts: 2127
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 is not online. 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
LeitrisArcade is not online. LeitrisArcade
Joined: 15 May 2010
Total Posts: 2127
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 is not online. 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 is not online. Tripane
Joined: 03 Jun 2011
Total Posts: 11432
02 Jan 2015 01:21 PM
n
Report Abuse
Tripane is not online. Tripane
Joined: 03 Jun 2011
Total Posts: 11432
02 Jan 2015 03:28 PM
um
Report Abuse
Tripane is not online. Tripane
Joined: 03 Jun 2011
Total Posts: 11432
02 Jan 2015 03:38 PM
omf
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image