Hi, i have problem with saving my text with DataStore2. It’s probably very easy to solve, but I can’t. I just need to save my text which is in playergui. I was able to save my Money and Lvl that are in leaderstats, but I can’t save text that is in playergui. Does anyone know what my problem is? (And Yes I tried to save text using just DataStore, but I got a lot of errors)
Script -
local DataStore2 = require(game:GetService("ServerScriptService"):WaitForChild("DataStore2"))
DataStore2.Combine("DATA", "Money")
DataStore2.Combine("DATA", "Exp")
DataStore2.Combine("DATA", "RevenuePerbottleText")
game.Players.PlayerAdded:Connect(function(Player)
local RevenuePerbottleText = Player.PlayerGui:WaitForChild("RevenuePerbottleGui"):WaitForChild("Frame"):WaitForChild("Main")
local MoneyStore = DataStore2("Money", Player)
local LvlStore = DataStore2("Lvl", Player)
local RevenuePerbottleTextStore = DataStore2("RevenuePerbottleText", Player)
local LeaderStats = Instance.new("Folder", Player)
LeaderStats.Name = "leaderstats"
local Money = Instance.new("NumberValue", LeaderStats)
Money.Name = "Money 💰"
Money.Value = MoneyStore:Get(0)
local Lvl = Instance.new("NumberValue", LeaderStats)
Lvl.Name = "Lvl ⭐"
Lvl.Value = LvlStore:Get(0)
RevenuePerbottleText.Text = RevenuePerbottleTextStore:Get(0)
MoneyStore:OnUpdate(function(UpdatedMoney)
Money.Value = UpdatedMoney
end)
LvlStore:OnUpdate(function(UpdatedLVl)
Lvl.Value = UpdatedLVl
end)
RevenuePerbottleTextStore:OnUpdate(function(UpdatedRevenuePerbottleText)
RevenuePerbottleText.Text = UpdatedRevenuePerbottleText
end)
end)
game.Workspace.Part33.ClickDetector.MouseClick:Connect(function(Player)
local MoneyStore = DataStore2("Money", Player)
MoneyStore:Increment(3)
end)
game.Workspace.Part44.ClickDetector.MouseClick:Connect(function(Player)
local LvlStore = DataStore2("Lvl", Player)
LvlStore:Increment(3)
end)
I will be very grateful to someone who will solve my problem.