|
| 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 |
|
|
|
| 17 Jun 2015 03:06 PM |
| http://wiki.roblox.com/index.php/Absolute_beginner%27s_guide_to_scripting |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 17 Jun 2015 03:10 PM |
| So I can get better, what exactly is wrong with my script? |
|
|
| Report Abuse |
|
|
|
| 17 Jun 2015 03:10 PM |
| Dont try his script. It will crash you. |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
| |
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 17 Jun 2015 03:35 PM |
| Your script doesn't' work :((((( |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|