Basically I’m trying to make a team only rank and points system where you need certain team points to rank-up in your team and these ranks and points are unique in each team.
It’s my first time working on this kind of stuff so I’m not really sure what to do, could somebody assist me and tell me what I would have to change and do for this to work?
Here is a video of me trying it in game, of course nothing worked:
Here are my code in both for the player rank and player points/stats:
Rank
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
local rs = game:GetService("ReplicatedStorage")
local leaderstats = player:WaitForChild("dataFolder")
local SciCheckValue = leaderstats:WaitForChild("SciencePoints")
local SciCheckRank = leaderstats:WaitForChild("ScienceRank")
local SciOverhead = rs:WaitForChild("OverHeads"):WaitForChild("sciOverhead")
if SciCheckValue.Value >= 1 and SciCheckValue.Value < 2 and player.Team.Name == "Science" then
local ovrh = SciOverhead:Clone()
ovrh.Parent = char.Head
ovrh.Frame.plrName = "[S-1]"..player.Name
ovrh.Frame.plrRank.Text = "Junior Scientist"
SciCheckRank.Value = 1
elseif SciCheckValue.Value >= 2 and SciCheckValue.Value < 4 and player.Team.Name == "Science" then
local ovrh = SciOverhead:Clone()
ovrh.Parent = char.Head
ovrh.Frame.plrName = "[S-2]"..player.Name
ovrh.Frame.plrRank.Text = "Scientist"
SciCheckRank.Value = 2
end
SciCheckValue.Changed:Connect(function()
if SciCheckValue.Value >= 0 and SciCheckValue.Value < 2 and player.Team.Name == "Science" then
local ovrh = SciOverhead:Clone()
ovrh.Parent = char.Head
ovrh.Frame.plrName = "[S-1]"..player.Name
ovrh.Frame.plrRank.Text = "Junior Scientist"
SciCheckRank.Value = 1
elseif SciCheckValue.Value >= 2 and SciCheckValue.Value < 4 and player.Team.Name == "Science" then
local ovrh = SciOverhead:Clone()
ovrh.Parent = char.Head
ovrh.Frame.plrName = "[S-2]"..player.Name
ovrh.Frame.plrRank.Text = "Scientist"
SciCheckRank.Value = 2
end
end)
end)
end)
Points/Data
local DataStore = game:GetService("DataStoreService")
local CashData = DataStore:GetDataStore("cashds-debug123")
local MilPoints = DataStore:GetDataStore("milpds-debug123")
local SciPoints = DataStore:GetDataStore("scipds-debug123")
local MilRank = DataStore:GetDataStore("milrds-debug123")
local SciRank = DataStore:GetDataStore("milrds-debug123")
local Value = 0
game.Players.PlayerAdded:Connect(function(player)
local DataFolder = Instance.new("Folder")
DataFolder.Name = ("dataFolder")
DataFolder.Parent= player
local cash = Instance.new("IntValue")
cash.Name = ("Cash")
cash.Parent = DataFolder
cash.Value = 1000
cash.Value = CashData:GetAsync(player.UserId) or Value
CashData:SetAsync(player.UserId, cash.Value)
local sci = Instance.new("IntValue")
sci.Name = ("SciencePoints")
sci.Parent = DataFolder
sci.Value = 1
sci.Value = SciPoints:GetAsync(player.UserId) or Value
SciPoints:SetAsync(player.UserId, sci.Value)
local scirank = Instance.new("StringValue")
scirank.Name = ("ScienceRank")
scirank.Parent = DataFolder
scirank.Value = 1
scirank.Value = SciRank:GetAsync(player.UserId) or Value
SciRank:SetAsync(player.UserId, scirank.Value)
--[[local mil = Instance.new("IntValue")
mil.Name = ("MilitaryPoints")
mil.Parent = DataFolder
mil.Value = 0
mil.Value = MilPoints:GetAsync(player.UserId) or Value
MilPoints:SetAsync(player.UserId, mil.Value)
local milrank = Instance.new("StringValue")
milrank.Name = ("MilitaryRank")
milrank.Parent = DataFolder
milrank.Value = 0
milrank.Value = MilRank:GetAsync(player.UserId) or Value
MilRank:SetAsync(player.UserId, milrank.Value)--]]
game.Players.PlayerRemoving:Connect(function(player)
CashData:SetAsync(player.UserId, player.dataFolder.Cash.Value)
SciPoints:SetAsync(player.UserId, player.dataFolder.SciencePoints.Value)
SciRank:SetAsync(player.UserId, player.dataFolder.ScienceRank.Value)
MilPoints:SetAsync(player.UserId, player.dataFolder.MilitaryPoints.Value)
MilRank:SetAsync(player.UserId, player.dataFolder.MilitaryRank.Value)
end)
end)
(Note: I’m not really a scripter so I mostly have no idea what I’m doing, I only know basic knowledge in scripting)