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: if rbx.lua == "wth" then fixMyScript() end

Previous Thread :: Next Thread 
cpmoderator12345 is not online. cpmoderator12345
Joined: 26 Jan 2013
Total Posts: 15651
03 Feb 2015 08:04 PM
local ds = game:GetService("DataStoreService"):GetDataStore("Level")

game.Players.PlayerAdded:connect(function(plr)
local l = Instance.new("IntValue", plr)
l.Name = "leaderstats"
local lvl = Instance.new("StringValue",l)
lvl.Name = "Level"
local key = tostring(plr.userId).."_level"
local data = ds:GetAsync(key) or 0
workspace.LevelTPer.Touched:wait()
lvl.Value = "1-1"
ds:SetAsync(key, lvl.Value)
end)

game.Players.PlayerRemoving:connect(function(plr)
local key = tostring(plr.userId).."_level"
local current = plr.leaderstats.Level
local data = ds:GetAsync(key)
if data then
ds:UpdateAsync(key,function(old) return current.Value; end)
else
ds:SetAsync(key,current.Value)
end
end)


//:cpmoderator12345:\\ ||:developer:||
Report Abuse
bosswalrus is not online. bosswalrus
Joined: 04 Jan 2013
Total Posts: 5430
03 Feb 2015 08:17 PM
k

"I like to program." - Bosswalrus
Report Abuse
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
03 Feb 2015 08:24 PM
You gave us so much information to work with!
Report Abuse
tbnj123 is online. tbnj123
Joined: 29 Oct 2010
Total Posts: 443
03 Feb 2015 08:36 PM
workspace.LevelTPer.Touched:wait()
Report Abuse
DogeKip is not online. DogeKip
Joined: 06 Mar 2011
Total Posts: 6860
03 Feb 2015 08:38 PM
I'm not even going to try to help because the condition we help is if rbx.lua == "wth" and I believe that is false so nope.

Mudkips > All ~ Previously: awesom914
Report Abuse
MM233 is not online. MM233
Joined: 19 Jun 2008
Total Posts: 925
03 Feb 2015 09:04 PM
The title WAS clever, none the less.
Report Abuse
cpmoderator12345 is not online. cpmoderator12345
Joined: 26 Jan 2013
Total Posts: 15651
03 Feb 2015 10:43 PM
There is nothing wrong with 'workspace.LevelTPer.Touched:wait()'
It does set the value to 1-1, but the Data Store doesn't save

//:cpmoderator12345:\\ ||:developer:||
Report Abuse
DigitalVeer is not online. DigitalVeer
Joined: 23 Jun 2009
Total Posts: 4182
03 Feb 2015 10:55 PM
After this line 'ds:SetAsync(key, lvl.Value)'
put

print(ds:GetAsync(key)) and see if it's saving.


Each time you set it, try printing it afterwards and see if it actually got set properly.

Also, try using this:
http://wiki.roblox.com/index.php?title=PlayerDataStore_module

It's great for automatically and efficiently saving data



Report Abuse
cpmoderator12345 is not online. cpmoderator12345
Joined: 26 Jan 2013
Total Posts: 15651
03 Feb 2015 11:00 PM
damn, now i have to re-write my script
AND use a module...

//:cpmoderator12345:\\ ||:developer:||
Report Abuse
parkiet3 is not online. parkiet3
Joined: 16 Jul 2011
Total Posts: 832
04 Feb 2015 12:40 AM
game.OnClose() = function()
wait(10)

end
Report Abuse
cpmoderator12345 is not online. cpmoderator12345
Joined: 26 Jan 2013
Total Posts: 15651
04 Feb 2015 12:43 AM
oh ok
im a idiot
wait but isnt setasync supposed to save?
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