Is anything wrong?
local leaderstats = game.Players.LocalPlayer.leaderstats
local Rank = leaderstats.Rank
local playerRank = script.Parent
if Rank.Value == leaderstats.Rank.Value then
playerRank.Text = Rank.Value
end
Is anything wrong?
local leaderstats = game.Players.LocalPlayer.leaderstats
local Rank = leaderstats.Rank
local playerRank = script.Parent
if Rank.Value == leaderstats.Rank.Value then
playerRank.Text = Rank.Value
end
What are you trying to do? In this script Rank.Value
and leaderstats.Rank.Value
are the same thing.
Make sure you do this
local leaderstats = game.Players.LocalPlayer:WaitForChild("leaderstats")
Probably the issue is that you aren’t using a event and the if statement runs only once, in this case I would suggest using the Players.PlayerAdded event as seen in the example below.
-- Variables --
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local PlayerRank = script.Parent
local Leaderstats = LocalPlayer:WaitForChild("leaderstats")
local Rank = Leaderstats:WaitForChild("Rank")
-- Events --
Players.PlayerAdded:Connect(function(Player)
if Rank.Value == Rank.Value then
PlayerRank.Text = Rank.Value
else
return false -- just a precaution
end
end)
Isn’t that just code smell though?