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: This saves the data right?

Previous Thread :: Next Thread 
Synthical is not online. Synthical
Joined: 06 Apr 2014
Total Posts: 2075
27 Nov 2014 09:05 PM
game.Players.PlayerAdded:connect(function(player)
local leaderstats = Instance.new("Model", player)
leaderstats.Name = "leaderstats"
local Interest = Instance.new("IntValue", leaderstats)
Interest.Name = "Bank"
Interest.Value = 0
end)

while wait(2.5) do
for _,Player in pairs(game.Players:GetPlayers()) do
if Player:FindFirstChild("leaderstats") then
Player.leaderstats.Bank.Value = Player.leaderstats.Bank.Value +25
end
end
end
game.Players.PlayerRemoving:connect(function(player)
if player:FindFirstChild("leaderstats") then
player:SaveNumber(player.leaderstats.Score.Value)
end
end)
Report Abuse
Synthical is not online. Synthical
Joined: 06 Apr 2014
Total Posts: 2075
27 Nov 2014 09:07 PM
Of course it doesn't.
Report Abuse
Synthical is not online. Synthical
Joined: 06 Apr 2014
Total Posts: 2075
27 Nov 2014 09:10 PM
I got it now I think
Report Abuse
Synthical is not online. Synthical
Joined: 06 Apr 2014
Total Posts: 2075
27 Nov 2014 09:11 PM
Nope, someone help. I didn't get it.
Report Abuse
Synthical is not online. Synthical
Joined: 06 Apr 2014
Total Posts: 2075
27 Nov 2014 09:13 PM
BUmmmppp.
Report Abuse
Synthical is not online. Synthical
Joined: 06 Apr 2014
Total Posts: 2075
27 Nov 2014 09:15 PM
B2
Report Abuse
Synthical is not online. Synthical
Joined: 06 Apr 2014
Total Posts: 2075
27 Nov 2014 09:17 PM
B3
Report Abuse
Synthical is not online. Synthical
Joined: 06 Apr 2014
Total Posts: 2075
27 Nov 2014 09:33 PM
B4
Report Abuse
Synthical is not online. Synthical
Joined: 06 Apr 2014
Total Posts: 2075
27 Nov 2014 09:36 PM
B5
Report Abuse
Synthical is not online. Synthical
Joined: 06 Apr 2014
Total Posts: 2075
27 Nov 2014 09:37 PM
B6
Report Abuse
DeviousDeviation is not online. DeviousDeviation
Joined: 28 Dec 2010
Total Posts: 9306
27 Nov 2014 09:38 PM
why are you using data persistence?
datastores are the way to go

logic is logical
Report Abuse
Synthical is not online. Synthical
Joined: 06 Apr 2014
Total Posts: 2075
27 Nov 2014 09:39 PM
BEcause I don't know how to use Datastores, it looks 10x more complicated.
Report Abuse
Synthical is not online. Synthical
Joined: 06 Apr 2014
Total Posts: 2075
27 Nov 2014 09:39 PM
Even if knew how to use them, how would I tie it into my script.
Report Abuse
Synthical is not online. Synthical
Joined: 06 Apr 2014
Total Posts: 2075
27 Nov 2014 09:42 PM
Ok, yeah, datastores make no sense, because how do I tie that into my script? Just type it at random in my script?
Report Abuse
DeviousDeviation is not online. DeviousDeviation
Joined: 28 Dec 2010
Total Posts: 9306
27 Nov 2014 09:44 PM
basicooly

local Scores = game:GetService("DataStoreService"):GetDataStore("Scores")

game.Players.PlayerAdded:connect(function(player)
local key = "user_" .. player.userId
local score = Scores:GetAsync(key) or 0
print(player.Name .. " has " .. score .. " points")
end)

logic is logical
Report Abuse
Synthical is not online. Synthical
Joined: 06 Apr 2014
Total Posts: 2075
27 Nov 2014 09:45 PM
And I insert that into my script?
Report Abuse
DeviousDeviation is not online. DeviousDeviation
Joined: 28 Dec 2010
Total Posts: 9306
27 Nov 2014 09:46 PM
.-.

go read the wiki

logic is logical
Report Abuse
Synthical is not online. Synthical
Joined: 06 Apr 2014
Total Posts: 2075
27 Nov 2014 09:48 PM
No, because that wiki confuses me.
Report Abuse
oofive2 is not online. oofive2
Joined: 08 May 2011
Total Posts: 1608
27 Nov 2014 09:50 PM
Scripting confuses me. I don't know why I come on this forum


~IlluminatiHitman~
Report Abuse
Synthical is not online. Synthical
Joined: 06 Apr 2014
Total Posts: 2075
27 Nov 2014 09:50 PM
Screw this, I just lost the whole game idea because of this crap. For reals. I had a script, why don't you just correct it for me because I don't know what I did wrong.
Report Abuse
DeviousDeviation is not online. DeviousDeviation
Joined: 28 Dec 2010
Total Posts: 9306
27 Nov 2014 09:52 PM
game.Players.PlayerAdded:connect(function(player)
local leaderstats = Instance.new("Model", player)
leaderstats.Name = "leaderstats"
local Interest = Instance.new("IntValue", leaderstats)
Interest.Name = "Bank"
Interest.Value = player:LoadNumber("Bank") or 0
end)

game.Players.PlayerRemoving:connect(function(player)
if player:FindFirstChild("leaderstats") then
player:SaveNumber("Bank", player.leaderstats.Bank.Value)
end
end)
end

logic is logical
Report Abuse
Synthical is not online. Synthical
Joined: 06 Apr 2014
Total Posts: 2075
27 Nov 2014 09:55 PM
Yeah, good. Thanks for the script, and thanks for wasting 15 minutes of my time.
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
27 Nov 2014 09:57 PM
you stupid dumbass gtfo we're not slaves

sorry your illiterate brain is incapable of reading the wiki


Report Abuse
Synthical is not online. Synthical
Joined: 06 Apr 2014
Total Posts: 2075
27 Nov 2014 09:57 PM
Oh great, now it doesn't add 25 like I wanted it to do. @Forever, I am not going to read something that confuses the living hell out of me.
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
27 Nov 2014 09:58 PM
---------> [ ]
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