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: I'm 99% sure this won't work but can you help me with it?

Previous Thread :: Next Thread 
KlinkStudios is not online. KlinkStudios
Joined: 31 Oct 2013
Total Posts: 563
17 Jun 2015 03:02 PM
I have no clue if this will work, I don't really get anything with data stores but I'm trying my best. Anway, this is supposed to save the look of the local player's GUI. Am I doing it wrong?

local DataStore = game:GetService("DataStoreService"):GetDataStore("ComputerSaved")
local GUI = game.Players.LocalPlayer.PlayerGui:WaitForChild("Computer1")
game.Players.PlayerAdded:connect(function(player)
local key = "user_" .. player.userId
DataStore:UpdateAsync(key, function()
local Properties = {}
for Key,Value in pairs (GUI) do
Properties[Key] = Value
return Value
end
end)
end)
Report Abuse
BothAngles is not online. BothAngles
Joined: 01 Dec 2011
Total Posts: 9604
17 Jun 2015 03:06 PM
http://wiki.roblox.com/index.php/Absolute_beginner%27s_guide_to_scripting
Report Abuse
KlinkStudios is not online. KlinkStudios
Joined: 31 Oct 2013
Total Posts: 563
17 Jun 2015 03:08 PM
Ha ha ha, very funny. I should mention that this is also a lot of stuff from the wiki that has been modified too.
Report Abuse
BothAngles is not online. BothAngles
Joined: 01 Dec 2011
Total Posts: 9604
17 Jun 2015 03:09 PM
ok try this

pcall(function()
local DataStore = game:GetService("DataStoreService"):GetDataStore("ComputerSaved")
local GUI = game.Players.LocalPlayer.PlayerGui:WaitForChild("Computer1")
game.Players.PlayerAdded:connect(function(player)
local key = "user_" .. player.userId
DataStore:UpdateAsync(key, function()
local Properties = {}
for Key,Value in pairs (GUI) do
Properties[Key] = Value
return Value
end
end)
end)
end)
while not error do
print("Saving")
end
Report Abuse
KlinkStudios is not online. KlinkStudios
Joined: 31 Oct 2013
Total Posts: 563
17 Jun 2015 03:10 PM
So I can get better, what exactly is wrong with my script?
Report Abuse
fishguy100 is not online. fishguy100
Joined: 16 Feb 2013
Total Posts: 3679
17 Jun 2015 03:10 PM
Dont try his script. It will crash you.
Report Abuse
fishguy100 is not online. fishguy100
Joined: 16 Feb 2013
Total Posts: 3679
17 Jun 2015 03:12 PM
local DataStore = game:GetService("DataStoreService"):GetDataStore("ComputerSaved")
local GUI = game.Players.LocalPlayer.PlayerGui:WaitForChild("Computer1")
game.Players.PlayerAdded:connect(function(player)
local key = "user_" .. player.userId
DataStore:UpdateAsync(key, function()
Properties = {}
for Key,Value in pairs (GUI) do
Properties[Key] = Value
return Value
end
end)
end)

game.Players.PlayerRemoving:connect(function(player)
key:SetAsync("user_"..player.userId,Peoperties)
end

THat should work.
Report Abuse
KlinkStudios is not online. KlinkStudios
Joined: 31 Oct 2013
Total Posts: 563
17 Jun 2015 03:12 PM
I modified it so it wouldn't, I figured it was an error on his end though.
Report Abuse
BothAngles is not online. BothAngles
Joined: 01 Dec 2011
Total Posts: 9604
17 Jun 2015 03:13 PM
doesnt work
Report Abuse
fishguy100 is not online. fishguy100
Joined: 16 Feb 2013
Total Posts: 3679
17 Jun 2015 03:14 PM
It wasnt an error. He trolls everyone. Just ignore him. He purpously tried to crash you. He did it to me when I was tired and not paying attention.
Report Abuse
KlinkStudios is not online. KlinkStudios
Joined: 31 Oct 2013
Total Posts: 563
17 Jun 2015 03:20 PM
Unless there is an issue with your script, will it just save the properties of the actual GUI and not the labels and stuff inside of it?
Report Abuse
KlinkStudios is not online. KlinkStudios
Joined: 31 Oct 2013
Total Posts: 563
17 Jun 2015 03:22 PM
I also modified your script:

local DataStore = game:GetService("DataStoreService"):GetDataStore("ComputerSaved")
local GUI = game.Players.LocalPlayer.PlayerGui:WaitForChild("Computer1")
game.Players.PlayerAdded:connect(function(player)
local key = "user_" .. player.userId
DataStore:UpdateAsync(key, function()
Properties = {}
for Key,Value in pairs (GUI) do
Properties[Key] = Value
return Value
end
end)
end)

game.Players.PlayerRemoving:connect(function(player)
local key = "user_" .. player.userId
key:SetAsync("user_"..player.userId,Properties)
end)
Report Abuse
fishguy100 is not online. fishguy100
Joined: 16 Feb 2013
Total Posts: 3679
17 Jun 2015 03:23 PM
What you did at the end wasn't necessary. Just erase the local key part and leave the line I wrote.
Report Abuse
KlinkStudios is not online. KlinkStudios
Joined: 31 Oct 2013
Total Posts: 563
17 Jun 2015 03:24 PM
The only issue is it says key is an unknown global if I don't do that.
Report Abuse
KlinkStudios is not online. KlinkStudios
Joined: 31 Oct 2013
Total Posts: 563
17 Jun 2015 03:35 PM
Your script doesn't' work :(((((
Report Abuse
fishguy100 is not online. fishguy100
Joined: 16 Feb 2013
Total Posts: 3679
17 Jun 2015 03:38 PM
I recommend learning more about DataStores. You seem fairly new to it. I will gladly help you along the way but dont start off with a project. Do tiny snippets at a time.
Report Abuse
KlinkStudios is not online. KlinkStudios
Joined: 31 Oct 2013
Total Posts: 563
17 Jun 2015 04:02 PM
I think I know how to use them to save actual ints and stuff now, but I still am not sure how I would go about saving the GUIs. Is there some method I could use?
Report Abuse
fishguy100 is not online. fishguy100
Joined: 16 Feb 2013
Total Posts: 3679
17 Jun 2015 04:03 PM
Just keep learning the basics of DataStores. Maybe some basics of lua to so you will be able to say "I know it!" instead of "I think I know it" :V)
Report Abuse
iSpecializinq is not online. iSpecializinq
Joined: 31 May 2015
Total Posts: 2182
17 Jun 2015 04:20 PM
You cannot directly save instances with data store; instead, save object values and be like "oh he has this, so give him this"
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