So I was somehow able to get this concept working.
Below is in short how the system works:
– This system lets play claim daily login reward every 24 hours.
– If player does not claim for 48 hours then it reset.
– It saves the days count and stuff everything properly
==================================
So what I need help with is, I want these 2 things to be saved as in player Gui
when the join the game and leave.
– Button Colour: Because colour of button changes after its claimed.
– Image: Because there is an “” Image which pops up after daily is claimed.
==================================
And there are like 30 buttons and 30 images since its 30 days system.
All the buttons from Reward 1 to Reward 30 Color changes after its claimed.
All The checks “” from Reward 1 to Reward 30 are in " CheckPopUp " Folder.
==================================
Now please tell me the best way of saving these 2 items <33
Store every reward that has been claimed in the datastore for the players that claimed them, load it when they join and then set the image and colour for the buttons.
I have this script from some another similar post but have no idea how to make it save my image and button color. I tried but kind of messed up.
So, can you tell me by editing it how I can exactly make it happen?
-- Get the services we need.
local dataStoreService = game:GetService("DataStoreService")
local players = game:GetService("Players")
-- Get when a player joins
players.PlayerAdded:Connect(function(plr)
-- Get the player's datastore
local ds = dataStoreService:GetDataStore(tostring(plr.UserId))
local success, response = pcall(function()
-- Get the value
return ds:GetAsync("gui_visible")
end)
-- Check if the request failed (if not, continue)
if (success) then
-- Check if the value is set to true
if (response) then
[FRAME].Visible = true
else
-- If the value is either false or it was never set
[FRAME].Visible = false
end
end
end)
players.PlayerRemoving:Connect(function(plr)
-- Get the player's datastore
local ds = dataStoreService:GetDataStore(tostring(plr.UserId))
-- Attempt to set the value
ds:SetAsync("gui_visible", [FRAME].Visible)
end)
unfortunately I don’t use datastores much so I can’t do the script for you exactly, but you would change [FRAME] for the colour of the gui, and create another variable for the image, could be Image and it would have a true or false value. If it was true, set the image visibility to true. For the colour, you could save the RGB and then load it
@Vampsster. Hey there! Sorry for such a late reply. I had no idea you even posted anything else. I don’t specialize in this kind of thing, sorry! I hope you got this fixed though!