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 » Scripting Helpers
Home Search
 

Help deciphering code/script. Data persistence.

Previous Thread :: Next Thread 
masta789 is not online. masta789
Joined: 13 Mar 2012
Total Posts: 181
20 Jul 2013 11:30 PM
game.Players.PlayerAdded:connect(function(p) -- what does the (function(p) do?
Stat1 = Instance.new("IntValue",p) -- again something to do with ^^
Stat1.Name = "TimerS"
Stat1.Value = 0
Stat4 = Instance.new("IntValue",p)
Stat4.Name = "TimerM"
Stat4.Value = 0
Stat5 = Instance.new("IntValue",p)
Stat5.Name = "TimerH"
Stat5.Value = 0
Stat2 = Instance.new("IntValue",p)
Stat2.Name = "WOs"
Stat2.Value = 0
Stat3 = Instance.new("IntValue",p)
Stat3.Name = "Played"
Stat3.Value = 0
repeat wait() until p.DataReady == true -- What does this do?
Stat1.Value = p:LoadNumber("Timer")
Stat2.Value = p:LoadNumber("WOs")
Stat3.Value = p:LoadNumber("Played")
Stat3.Value = Stat3.Value +1 --What?
p.CharacterAdded:connect(function(char)
char.Humanoid.Died:connect(function()
p.WOs.Value = p.WOs.Value +1 -- Again what?
end)
end)
while true do
wait(1)
if Stat1.Value == 59 then --Whats this down to the ^^
Stat4.Value = Stat4.Value +1
if Stat4.Value == 60 then
Stat4.Value = 0
Stat5.Value = Stat5.Value +1
end
Stat1.Value = 0
elseif Stat1.Value ~= 59 then
Stat1.Value = Stat1.Value +1
end
end
end) --^^

game.Players.PlayerRemoving:connect(function(p)
p:SaveNumber("Timer",p.Timer.Value)
p:SaveNumber("WOs",p.WOs.Value)
p:SaveNumber("Played",p.Played.Value)
end)


Also not sure if the Script/code work but i believe the meaning is the same.
Please help...
Report Abuse
canada1232111 is not online. canada1232111
Joined: 16 Jan 2013
Total Posts: 863
20 Jul 2013 11:36 PM
Okay here it goes.

game.Players.PlayerAdded:connect(function(p) -- function p is something that is triggered by an event like
Stat1 = Instance.new("IntValue",p) -- making an IntValue --Touch^
Stat1.Name = "TimerS"
Stat1.Value = 0
Stat4 = Instance.new("IntValue",p)
Stat4.Name = "TimerM"
Stat4.Value = 0
Stat5 = Instance.new("IntValue",p)
Stat5.Name = "TimerH"
Stat5.Value = 0
Stat2 = Instance.new("IntValue",p)
Stat2.Name = "WOs"
Stat2.Value = 0
Stat3 = Instance.new("IntValue",p)
Stat3.Name = "Played"
Stat3.Value = 0
repeat wait() until p.DataReady == true -- Wait for the players data to be loaded (ready).
Stat1.Value = p:LoadNumber("Timer")
Stat2.Value = p:LoadNumber("WOs")
Stat3.Value = p:LoadNumber("Played")
Stat3.Value = Stat3.Value +1 --Ads 1 more point to Stat3's value.
p.CharacterAdded:connect(function(char)
char.Humanoid.Died:connect(function()
p.WOs.Value = p.WOs.Value +1 -- This ads 1 more point to WOs when a player dies.
end)
end)
while true do
wait(1)
if Stat1.Value == 59 then --If a player stat1's value is equal to 59 then.
end) --^^ ends the function

game.Players.PlayerRemoving:connect(function(p)
p:SaveNumber("Timer",p.Timer.Value)
p:SaveNumber("WOs",p.WOs.Value)
p:SaveNumber("Played",p.Played.Value)
end)



Anymore questions?
Report Abuse
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
20 Jul 2013 11:38 PM
I could write that script half as big as tht one (>_<)
Report Abuse
masta789 is not online. masta789
Joined: 13 Mar 2012
Total Posts: 181
20 Jul 2013 11:57 PM
That's nice, I'm just a novice.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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