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: Data Persistence trouble.

Previous Thread :: Next Thread 
spinywind is online. spinywind
Joined: 26 Jan 2012
Total Posts: 3580
13 Dec 2015 11:35 PM
Iv been struggling on this code for a while now. I can only seem to get the point rewarder and text changer done. I really need help on this one.

What needs to be fixed:
- I basically want it so that when you redeem a correct code, the amount of points you get from the code from a value, you will get every game when you join a new server

What needs to be done:
- Making it so a player can only put a code in once no matter what server there in or if they reset or just in general. Just so the code can only be used once for ever


If anyone can manage to do this id appreciate it a lot and put you as an admin to all my games.

Now this code is in a server script.

Code:

function A()
game.Players.PlayerRemoving:connect(function(p)
if p:findFirstChild("leaderstats") then
p:SaveInstance("SavedStatPNum"..tostring(game.PlaceId),p.leaderstats)
end
end)
game.Players.PlayerAdded:connect(function(p)
for k = 1, 60, 0.03 do
wait()
if p:findFirstChild("leaderstats") and p.DataReady then break end
end
local Loaded = nil
if p:findFirstChild("leaderstats") and pcall(function() Loaded = p:LoadInstance("SavedStatPNum"..tostring(game.PlaceId)) end) then
for j, v in pairs(Loaded:GetChildren()) do
pcall(function() p.leaderstats.Points = p.leaderstats.Points + 1500 end)
end
end
end)
local Points = script.Parent.Parent.Parent.Parent.Parent.leaderstats.Points
if script.Parent.Parent.Code.Text == script.Parent.Parent.Code.Code.Value then
script.Parent.Sound:Play()
Points.Value = Points.Value + 1500

wait(1)
script.Parent.Parent.Code.Text = "Click to enter your code"
elseif script.Parent.Parent.Code.Text == "Santa" or "SANTA" or "sANTA" or "santA" then
script.Parent.Parent.Code.Text = "Invalid Code"
wait(4)
script.Parent.Parent.Code.Text = "Click to enter your code"
end
end

script.Parent.MouseButton1Down:connect(A)
Report Abuse
NormaINorm is not online. NormaINorm
Joined: 11 Dec 2012
Total Posts: 315
13 Dec 2015 11:39 PM
Your wasting your time learning data persistence; use datastores, their much more efficient and secure.
Report Abuse
LongKillKreations is not online. LongKillKreations
Joined: 14 Feb 2014
Total Posts: 4502
13 Dec 2015 11:50 PM
Data persistence is outdated, use datastore. It has far better capabilities and is much more reliable.
Report Abuse
twister1976 is not online. twister1976
Joined: 17 Sep 2010
Total Posts: 2250
14 Dec 2015 12:04 AM
http://wiki.roblox.com/index.php?title=Saving_Player_Data
That page will show you how to save player data efficiently with datastores.

If money grew on trees... It would be as valuable as leaves. | Twitter: @TwisterRBLX
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