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
 

Re: Changed event question

Previous Thread :: Next Thread 
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
07 Jun 2014 12:18 AM
Does changed event work with Data Store values? Example:

Data = game:GetService("DataStoreService")
Data.Changed:connect(function(Data:GetAsync("Key"))

?
Report Abuse
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
07 Jun 2014 12:21 AM
Help
Report Abuse
Usering is online. Usering
Joined: 18 Aug 2012
Total Posts: 10281
07 Jun 2014 12:25 AM
You would use the OnUpdate method of GlobalDataStore

DataStore = game:GetService("DataStoreService"):GetGlobalDataStore()

DataStore:OnUpdate("key",function()
--Callback function for when it is updated
end)
Report Abuse
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
07 Jun 2014 12:29 AM
Ohhh, because at first I was using while true do method to check if the value change but it was sort of inefficient with the small delay. So I use OnUpdate which is like the Changed event?
Report Abuse
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
07 Jun 2014 06:02 AM
I was just wondering, would it be the same if each player had something saved?
Example:


Data = game:GetService("DataStoreService"):GetDataStore("Points")
function onTouch(Player)
Data:IncrementAsync(Player.name, 1)
end
script.Parent.Touched:connect(onTouch)


How would it look like if each player had a value? Would it be the same or different?
Report Abuse
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
07 Jun 2014 06:47 AM
Help.
Report Abuse
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
07 Jun 2014 06:53 AM
Help!
Report Abuse
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
07 Jun 2014 06:59 AM
Help?
Report Abuse
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
07 Jun 2014 07:04 AM
Anyone?
Report Abuse
DataStore is not online. DataStore
Joined: 07 Feb 2012
Total Posts: 8540
07 Jun 2014 07:06 AM
@Para,
I don't quite get what you're asking. The only thing you'd change, if you were using OnUpdate, would be the 'key' (first argument).

Also, you shouldn't use the player's name as a key as they're able to change it.

Report Abuse
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
07 Jun 2014 07:12 AM
Oh, ok because I was counting clicks and I wanted to display the person who made the most clicks, so that was why I make a key for each player, so the key should just be then: 'Player.Name'?
Report Abuse
DataStore is not online. DataStore
Joined: 07 Feb 2012
Total Posts: 8540
07 Jun 2014 07:20 AM
DataStore:OnUpdate(Player.Name, function(UpdatedValue)
print(UpdatedValue)
end)

But as I said, you shouldn't use the player's name simply because if they change their username they'll lose all their data in your game. Use their userId instead (Player.userId).
Report Abuse
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
07 Jun 2014 07:21 AM
Ohhhhhh! Wow, that was so useful! Thank you so much! By the way, nice username, lol
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