local script
local Player = game.Players.LocalPlayer
Player.PlayerGui.StatLabels.ClickStatFrame.ClickStatLabel.Text = Player:WaitForChild("leaderstats"):WaitForChild("Clicks").Value
Player.PlayerGui.StatLabels.RebirthStatFrame.RebirthStatLabel.Text = Player:WaitForChild("leaderstats"):WaitForChild("Rebirths").Value
Player.leaderstats.Clicks:GetPropertyChangedSignal("Value"):Connect(function()
Player.PlayerGui.StatLabels.ClickStatFrame.ClickStatLabel.Text = Player.leaderstats.Clicks.Value
end)
Player.leaderstats.Rebirths:GetPropertyChangedSignal("Value"):Connect(function()
Player.PlayerGui.StatLabels.RebirthStatFrame.RebirthStatLabel.Text = Player.leaderstats.Rebirths.Value
end)
Script
local DataStoreService = game:GetService("DataStoreService")
local ClicksStore = DataStoreService:GetDataStore("Clicks")
local RebirthsStore = DataStoreService:GetDataStore("Rebirths")
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder",player)
leaderstats.Name = "leaderstats"
local Clicks = Instance.new("IntValue",leaderstats)
Clicks.Name = "Clicks"
if ClicksStore:GetAsync(player.UserId) == nil then
Clicks.Value = 500
else
Clicks.Value = ClicksStore:GetAsync(player.UserId)
end
local Rebirths = Instance.new("IntValue",leaderstats)
Rebirths.Name = "Rebirths"
if RebirthsStore:GetAsync(player.UserId) == nil then
Rebirths.Value = 0
else
Rebirths.Value = RebirthsStore:GetAsync(player.UserId)
end
end)
game.Players.PlayerRemoving:Connect(function(player)
ClicksStore:SetAsync(player.UserId,player.leaderstats.Clicks.Value)
RebirthsStore:SetAsync(player.UserId,player.leaderstats.Rebirths.Value)
end)
When I join, the RebirthLabel is working fine, but the ClickLabel says 0 until I click the screen(Changing the property Value(GetPropertyChangedSignal)). Ex: Lets say my Clicks value is 2000, when i first join, it says 0, but when i first click it changes to 2001.