|
| 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 |
|
|
| |
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
| |
|
| |
|
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 |
|
|
|
| 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 |
|
|
| |
|
Siberith9
|
  |
 |
| 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 |
|
|