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: DataStore problem

Previous Thread :: Next Thread 
HyperProduct is not online. HyperProduct
Joined: 11 Nov 2012
Total Posts: 3362
25 Dec 2015 04:08 PM
I'm still trying to learn how to use DataStore, but I made this script:



local DataStore = game:GetService("DataStoreService"):GetDataStore("Appearance")

game.Players.PlayerAdded:connect(function(Player)
Player:WaitForDataReady()

local function SaveColor3(key, Vector3, SecondVector3)
DataStore:SetAsync(key, {{Vector3.Value.x, Vector3.Value.y, Vector3.Value.z},{SecondVector3.Value.x, SecondVector3.Value.y, SecondVector3.Value.z}})
end

local color = Instance.new("Vector3Value")
color.Name = "BodyColor"
color.Parent = Player

local color2 = Instance.new("Vector3Value")
color2.Name = "EyeColor"
color2.Parent = Player

local key = "user_"..Player.userId
local savedData = DataStore:GetAsync(key)
if (savedData) then
local loadedData = DataStore:GetAsync(key)
color.Value = Vector3.new(loadedData[1][1],loadedData[1][2],loadedData[1][3])
color2.Value = Vector3.new(loadedData[2][1],loadedData[2][2],loadedData[2][3])
wait(3.65)
Player.Character.Chest.Body.Mesh.VertexColor = color.Value
Player.Character.Chest.Tail.Mesh.VertexColor = color.Value
Player.Character.Chest.Hand1.Mesh.VertexColor = color.Value
Player.Character.Chest.Hand2.Mesh.VertexColor = color.Value
Player.Character.Chest.EyeColor1.Mesh.VertexColor = color2.Value
Player.Character.Chest.EyeColor2.Mesh.VertexColor = color2.Value
else
color.Value = Vector3.new(0,0,0)
color2.Value = Vector3.new(0,0,0)
end

color.Changed:connect(function(Val)
SaveColor3(key,color,color2)
end)

color2.Changed:connect(function(Val)
SaveColor3(key,color,color2)
end)
end)



The problem is that color2 always ends up being black. Why? There's no errors in the output.
Report Abuse
HyperProduct is not online. HyperProduct
Joined: 11 Nov 2012
Total Posts: 3362
25 Dec 2015 04:37 PM
Bump
Report Abuse
AdvancedObjects is not online. AdvancedObjects
Joined: 11 Dec 2012
Total Posts: 3354
25 Dec 2015 04:41 PM
"color2.Value = Vector3.new(0,0,0)" Make's it black the first time since they don't have any data.
Then when they come back the second time this data comes changes the vetex to black.
Report Abuse
HyperProduct is not online. HyperProduct
Joined: 11 Nov 2012
Total Posts: 3362
25 Dec 2015 04:50 PM
But color works perfectly, just not color2. I feel like it's something with how I load it, but idk what.
Report Abuse
HyperProduct is not online. HyperProduct
Joined: 11 Nov 2012
Total Posts: 3362
25 Dec 2015 05:20 PM
Oh I forgot to mention that they change the color inside the game.
So when they join they have black eyes and black body color,
then they, for example, change to blue eyes and green body color,
they leave the game and come back,
they have green body color but still black eyes. Why?
Report Abuse
HyperProduct is not online. HyperProduct
Joined: 11 Nov 2012
Total Posts: 3362
25 Dec 2015 07:27 PM
Bump
Report Abuse
HyperProduct is not online. HyperProduct
Joined: 11 Nov 2012
Total Posts: 3362
25 Dec 2015 09:39 PM
Bump...
Report Abuse
gangman67 is not online. gangman67
Joined: 04 Jun 2011
Total Posts: 798
25 Dec 2015 09:52 PM
Is it because youre using vector3 and not color3?
Report Abuse
HyperProduct is not online. HyperProduct
Joined: 11 Nov 2012
Total Posts: 3362
25 Dec 2015 10:03 PM
No, because I'm changing the VertexColor of a mesh, which uses Vector3. Like I said, the normal body color works fine but not the eye color.
Report Abuse
HyperProduct is not online. HyperProduct
Joined: 11 Nov 2012
Total Posts: 3362
26 Dec 2015 02:26 AM
Bump
Report Abuse
Siberith9 is not online. Siberith9
Top 100 Poster
Joined: 22 Nov 2008
Total Posts: 28153
26 Dec 2015 02:43 AM
Sounds like a simple debugging problem. Go through the debugging process and see where the mesh/color changes incorrectly.
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