So this is my code:
game.Players.PlayerRemoving:Connect(function(Player)
local Slot1 = Player.PlayerGui.CustomGradient.Frame.MainFrame.GradientSaves.Slot1.Saved.Color
local Slot2 = Player.PlayerGui.CustomGradient.Frame.MainFrame.GradientSaves.Slot2.Saved.Color
local Slot3 = Player.PlayerGui.CustomGradient.Frame.MainFrame.GradientSaves.Slot3.Saved.Color
local Slot4 = Player.PlayerGui.CustomGradient.Frame.MainFrame.GradientSaves.Slot4.Saved.Color
DataStore:SetAsync(Player.UserId, {
S1 = Slot1,
S2 = Slot2,
S3 = Slot3,
S4 = Slot4
})
print("DataSaved")
end)
My problem is that it doesn’t find the PlayerGui and I need it so I can save their custom gradients when they leave the game. How do I fix this?
Error: