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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: DataStore help

Previous Thread :: Next Thread 
zafariki is not online. zafariki
Joined: 12 Oct 2010
Total Posts: 42
12 Dec 2015 05:41 PM
So i have scripted this using allot of wiki reading and help from other users..
BUT!.. It doesn't work :c
This script load the value's wich the gui can work with ( that part works ) But I the problem is I can't get the value's for the gui there in online mode. i've tried allot , it's might be a stupid mistake or something idk but i'm out of idea's of possible problems. game link: http://www.roblox.com/games/232617477

------------- [Code] ---------------------------------------------------------

local DataStore = game:GetService("DataStoreService"):GetDataStore("Store")
print('worked')
game.Players.PlayerAdded:connect(function(p)
--p:WaitForDataReady()
print('worked')
local data = DataStore:GetAsync("user_"..p.userId)
print('worked')

local PlayerData = Instance.new("Folder")
PlayerData.Name = "PlayerData"
PlayerData.Parent = p

local Weapon = Instance.new("StringValue")
Weapon.Name = "Weapon"
Weapon.Parent = PlayerData
Weapon.Value = "Famas F1"

local Stats = Instance.new("Folder")
Stats.Name = "Stats"
Stats.Parent = PlayerData

local Kills = Instance.new("NumberValue")
Kills.Name = "Kills"
Kills.Parent = Stats
Kills.Value = 0

local Deaths = Instance.new("NumberValue")
Deaths.Name = "Deaths"
Deaths.Parent = Stats
Deaths.Value = 0

local XP = Instance.new("NumberValue")
XP.Name = "XP"
XP.Parent = Stats
XP.Value = 0

local Settings = Instance.new("Folder")
Settings.Name = "Settings"
Settings.Parent = PlayerData

local Volume = Instance.new("NumberValue")
Volume.Name = "Volume"
Volume.Parent = Settings
Volume.Value = 100

local Quality = Instance.new("NumberValue")
Quality.Name = "Quality"
Quality.Parent = Settings
Quality.Value = 0.5

local AccentColor = Instance.new("Color3Value")
AccentColor.Name = "AccentColor"
AccentColor.Parent = Settings
AccentColor.Value = Color3.new(0.882353, 0.666667, 0)

local Sounds = Instance.new("Folder")
Sounds.Name = "Sounds"
Sounds.Parent = PlayerData

local tic_sound = Instance.new("Sound")
tic_sound.Name = "tic_sound"
tic_sound.Parent = Sounds
tic_sound.SoundId = "rbxassetid://177266782"

local select_sound = Instance.new("Sound")
select_sound.Name = "select_sound"
select_sound.Parent = Sounds
select_sound.SoundId = "rbxassetid://146730311"
----------------------------------------------------
if data then
print('worked')
Kills.Value = data["Kills"]
print('worked')
Deaths.Value = data["Deaths"]
print('worked')
XP.Value = data["XP"]
print('worked')
Weapon.Value = data["Weapon"]
print('worked')
AccentColor.Value = Color3.new(unpack(data["AccentColor"])) -- unpack of the RGB table
print('worked')
end
end)

game.Players.PlayerRemoving:connect(function(p)
local DataToSave = {Kills=p.PlayerData.Stats.Kills.Value,Deaths=p.PlayerData.Stats.Deaths.Value,XP=p.PlayerData.Stats.XP.Value,Weapon=p.PlayerData.Stats.Weapon.Value,AccentColor = {p.PlayerData.Settings.AccentColor.Value}} -- I did this table to load the RGB color of this Color3 value, they will be unpacked later
DataStore:SetAsync("user_"..p.userId, DataToSave)
end)

game.OnClose = function()
wait(3)
end
Report Abuse
zafariki is not online. zafariki
Joined: 12 Oct 2010
Total Posts: 42
12 Dec 2015 05:41 PM
game link : http://www.roblox.com/games/232617477/Test-Gui
Report Abuse
zafariki is not online. zafariki
Joined: 12 Oct 2010
Total Posts: 42
12 Dec 2015 07:17 PM
bump
Report Abuse
zafariki is not online. zafariki
Joined: 12 Oct 2010
Total Posts: 42
15 Dec 2015 10:38 AM
Someone??
Report Abuse
zafariki is not online. zafariki
Joined: 12 Oct 2010
Total Posts: 42
19 Dec 2015 01:37 PM
Nvm , fixed it ;)
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