Basically, I have made a script and wrapped it in a coroutine. It checks for the player’s game time in the game and if it is certain, it will change their in game leaderstats. When I increase it, it just stays on Beginner.
Note that this is the half script ( the other half is data stores)
--// Variables, Services and functions
local dataStore = game:GetService("DataStoreService"):GetDataStore("TimeDataStore")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local gameSeconds = ReplicatedStorage:WaitForChild("GameSeconds")
local playersLeft = 0
local defaultTime = 0
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
playersLeft = playersLeft + 1
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local playerName = Instance.new("StringValue")
playerName.Name = "Name"
playerName.Value = player.Name
playerName.Parent = leaderstats
local Teir = Instance.new("StringValue")
Teir.Name = "Teir"
Teir.Value = "None"
Teir.Parent = leaderstats
local timeSpent = Instance.new("IntValue")
timeSpent.Name = "Game Time"
timeSpent.Value = gameSeconds.Value
timeSpent.Parent = leaderstats
local newThread = coroutine.create(function()
while true do
player.leaderstats["Game Time"].Value = player.leaderstats["Game Time"].Value + 1
if player.leaderstats["Game Time"].Value >= 7199 then
player.leaderstats.Teir.Value = "Beginner"
elseif player.leaderstats["Game Time"].Value >= 17999 then
player.leaderstats.Teir.Value = "Novice"
elseif player.leaderstats["Game Time"].Value >= 53999 then
player.leaderstats.Teir.Value = "Expert"
elseif player.leaderstats["Game Time"].Value >= 107999 then
player.leaderstats.Teir.Value = "Overseer"
end
wait(1)
end
end)
coroutine.resume(newThread)
Also, I change it on the server since changing it on the client won’t replicate. The other solution I was thinking was to arrange these statements from high to low.