EVERYTHING HERE IS IN THE SAME SCRIPT
Basically, Every player has their own xp GUI. But when I load the game up with 4 or so players, even the players with 0xp, 6xp etc... show 20xp which is what the highest player has. Ill show you part of my code, I don't want to spam and show the whole things but if anyone can help that would be great!
function onPlayerEntered(newPlayer)
newPlayer.Changed:connect(function (property)
if (property == "Character") then
newPlayer.PlayerGui.xp.TextLabel.Text = "XP " .. xp.Value .. "/100"
CharacterRemoving(newPlayer)
end
end)
This assigns the TextLabel text with the player thats just been added xp value.
if ds:GetAsync("Key2" .. newPlayer.Name) then
xp.Value = ds:GetAsync("Key2" .. newPlayer.Name)
else
xp.Value = 0
end
And just not to be too confusing I am using Roblox's datastore services to save everyone's score etc...
And i'm really sorry to be an arse here but the more info I provide the easier it will be to figure out.
p = game.Players:GetPlayers()
for i = 1, #p do
s = Instance.new("StringValue", p[i].Character)
s.Name = "Playing"
end
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"
coins = Instance.new("IntValue")
coins.Name = "Coins"
tokens = Instance.new("IntValue")
tokens.Name = "Tokens"
xp = Instance.new("IntValue")
xp.Name = "XP"
levels = Instance.new("IntValue")
levels.Name = "Levels"
coins.Parent = stats
tokens.Parent = stats
xp.Parent = stats
stats.Parent = newPlayer
Everything is being saved into the leaderboard.
Sorry guys for this but thanks for the help if any is given!

1 comment
In your first code block, instead of assigning the text value based on the xp value in the leaderboard, set it from the datastore value. That should fix your problem. Also, when you make a new instance, there is an optional second parameter that assigns the new instances parent.