I’m trying to save my Color3 in DataStore but what I’ve tried hasn’t worked and the script is kind of broken atm so it doesn’t work :/
Please help me fix it.
01 | local DataStoreService = game:GetService( "DataStoreService" ) |
03 | local RGBValue = DataStoreService:GetDataStore( "CACDataStoreKiRGB" ) |
07 | game.ReplicatedStorage.SendColor 1. OnServerEvent:Connect( function (player, Color 3 Value) |
09 | player.CACData.KiRGB.Value = Color 3 Value |
13 | game:GetService( "Players" ).PlayerAdded:Connect( function (player) |
15 | local CACData = player.CACData |
17 | player:WaitForChild( "CACData" ) |
19 | local KiRGB = player.CACData.KiRGB |
21 | local function loadColor 3 FromDataStore(KiRGB) |
23 | return Color 3. new(KiRGB.r, KiRGB.g, KiRGB.b) |
27 | KiRGB.Value = RGBValue:GetAsync(player.UserId, loadColor 3 FromDataStore()) |
29 | function getSaveableColor 3 (KiRGB) |
31 | return { r = player.CACData.Red.Value, g = player.CACData.Green.Value, b = player.CACData.Blue.Value } |
35 | game.ReplicatedStorage.SaveData.OnServerEvent:Connect( function (player) |
37 | KiRGB.Value = RGBValue:SetAsync(player.UserId, Color 3. fromRGB(getSaveableColor 3 (KiRGB))) |