So I'm currently working on a Rank system that is determined by the players team, and level but for some reason when It re-assigns the player's rank, when they level up it does not stick and continues to run off of their previous team's ranks. What is happening?
---//Services\\---
local ReplicatedStorage = game:GetService("ReplicatedStorage")
--//ServiceChildren\\--
local USRankHandler = require(ReplicatedStorage.RankHandler:WaitForChild("USRankHandler")) ---module script
local VRankHandler = require(ReplicatedStorage.RankHandler:WaitForChild("VRankHandler")) ---module script(do not worry about this.)
---//USRankHandler\\---
game.Players.PlayerAdded:Connect(function(player)
if player.TeamColor == BrickColor.new("Cyan") then
player:WaitForChild("leaderstats").Rank.Value = USRankHandler.Rank(player:WaitForChild("leaderstats2").Level.Value) ---Rank is a StringValue level is a IntValue
player.leaderstats2.Level:GetPropertyChangedSignal("Value"):Connect(function()
player:WaitForChild("leaderstats").Rank.Value = USRankHandler.Rank(player:WaitForChild("leaderstats2").Level.Value)
end)
end
end)
--//USRankTeamChange\\--
game.Players.PlayerAdded:Connect(function(player)
player:GetPropertyChangedSignal("TeamColor"):Connect(function()
if player.TeamColor == BrickColor.new("Cyan") then
player:WaitForChild("leaderstats").Rank.Value = USRankHandler.Rank(player:WaitForChild("leaderstats2").Level.Value)
end
end)
end)
Thank you, Vincent
P.S If you need the module scripts please comment asking! :)
