01 | local DataStore = game:GetService( "DataStoreService" ) |
02 | local ds = DataStore:GetDataStore( "MoneySaveSystem" ) |
03 |
04 | game.Players.PlayerAdded:connect( function (player) |
05 | local SkinColor = player:WaitForChild( "Data" ).SkinColor |
06 | SkinColor.Value = ds:GetAsync(player.UserId) |
07 | SkinColor.Changed:connect( function () |
08 | ds:SetAsync(player.UserId, SkinColor.Value) |
09 |
10 | end ) |
11 | end ) |
12 |
13 | game.Players.PlayerRemoving:connect( function (player) |
14 | ds:SetAsync(player.UserId, player.SkinColor.Value) |
15 | end ) |
Im trying to change the skincolor (from a value) for a character but it doesn't seem to work
you would need to save 3 seperate values in a table, here's how:
01 | local DataStore = game:GetService( "DataStoreService" ) |
02 | local ds = DataStore:GetDataStore( "MoneySaveSystem" ) |
03 |
04 | game.Players.PlayerAdded:connect( function (player) |
05 | local SkinColor = player:WaitForChild( "Data" ).SkinColor |
06 | local Data = ds:GetAsync(player.UserId) |
07 | if Data then |
08 | SkinColor.Value = Color 3. fromRGB(Data [ 1 ] ,Data [ 2 ] ,Data [ 3 ] ) |
09 | else |
10 | SkinColor.Value = Color 3. fromRGB( 255 , 255 , 255 ) --White |
11 | end |
12 | SkinColor.Changed:connect( function () |
13 | ds:SetAsync(player.UserId, { SkinColor.Value.r,SkinColor.Value.g,SkinColor.Value.b } ) |
14 |
15 | end ) |
16 | end ) |
17 |
18 | game.Players.PlayerRemoving:connect( function (player) |
19 | ds:SetAsync(player.UserId, { SkinColor.Value.r,SkinColor.Value.g,SkinColor.Value.b } ) |
20 | end ) |
Hopefully This Helps