✓ Accepted answer
You could make two values inside the player, using this script:
game.Players.PlayerAdded:Connect(function(plr)
local folder = Instance.new("Folder")
folder.Name = "ExpStats"
folder.Parent = plr
local LVL = Instance.new("IntValue")
LVL.Name = "LVL"
LVL.Parent = folder
local EXP = Instance.new("IntValue")
EXP.Name = "EXP"
EXP.Parent = folder
end)
Then inside that script, make a datastore to save the values for the next time the player joins, so the entire script should look something like:
local datastore = game:GetService("DataStoreService")
local ds1 = datastore:GetDataStore("ExpSaveSystem")
local ds2 = datastore:GetDataStore("LevelSaveSystem")
game.Players.PlayerAdded:Connect(function(plr)
local folder = Instance.new("Folder")
folder.Parent = plr
folder.Name = "ExpStats"
local LVL = Instance.new("IntValue")
LVL.Parent = folder
LVL.Name = "LVL"
local EXP = Instance.new("IntValue")
EXP.Name = "EXP"
EXP.Parent = folder
EXP.Value = ds1:GetAsync(plr.UserId) or 0
ds1:SetAsync(plr.UserId, EXP.Value)
LVL.Value = ds2:GetAsync(plr.UserId) or 0
ds2:SetAsync(plr.UserId, LVL.Value)
EXP.Changed:Connect(function()
ds1:SetAsync(plr.UserId, EXP.Value)
end)
LVL.Changed:connect(function()
ds2:SetAsync(plr.UserId, LVL.Value)
end)
end)
Then, In another script, make a script that when the player chats, it checks if they have enough exp to lvl and if they do, to increase the lvl by one.
local teams = {"Politie"}
game.Players.PlayerAdded:Connect(function(player)
local EXP = player.ExpStats.EXP
local LVL = player.ExpStats.LVL
player.Chatted:Connect(function(msg)
if msg:lower() == ';rankup'..player.Name..'teams'..'' then
if EXP.Value <= WhateverValTheyNeedToRankUp then
EXP.Value = EXP.Value - WhateverValTheyNeedToRankUp
LVL.Value = LVL.Value + 1
end
end
end
end)
4 comments
I rlly couldn't understand what u were saying, cause ur puncuation and grammar is ehhhh. So feel free to comment if u need anything
I want that they check what team it is and what player so the player get’s the rankup and not the player who is doing the command?
?
I don't think that's possible.. cause you'd have to reference a playername instead another string which wouldnt work.