SlayterZ
(SlayterZ)
December 18, 2023, 3:46pm
#1
Although I have a leaderboard in-game, the leaderboard does not update its values. Is there a way to achieve this?
local EXPVar = game.ReplicatedStorage.PlayerStats.EXP
game.Players.PlayerAdded:Connect (function(player)
player.CharacterAdded:Connect (function(character)
------- PLAYER LEADERSTATS FOLDER -------------------------------------------------------
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local Power = Instance.new("IntValue")
Power.Name = "Power"
Power.Value = 0
Power.Parent = leaderstats
local EXP = Instance.new("IntValue")
EXP.Name = "EXP"
EXP.Value = EXPVar.Value
EXP.Parent = leaderstats
end)
end)
1 Like
LxckyDev
(LuckyEcho)
December 18, 2023, 6:45pm
#2
I need more detail on what you want, but to add and subtract values to your stats you just do,
player.leaderstats.Power.Value += 50
or
player.leaderstats.EXP.Value -= 75
2 Likes
LxckyDev
(LuckyEcho)
December 18, 2023, 6:46pm
#3
And is ExpVar a IntValue? Send me a picture of ReplicatedStorage
2 Likes
SlayterZ
(SlayterZ)
December 18, 2023, 6:54pm
#4
Yes. I would like to add or subtract its values. But, to test it, I have an object that, when touched, adds value to it. However, that value does not convert onto the leaderboard’s value. Only the printed value.
test.Touched:Connect(function(partTouched)
print(“testtouch”)
EXPAdd.Value = EXPAdd.Value + 1
print(EXPAdd.Value)
wait(5)
end
end)
LxckyDev
(LuckyEcho)
December 18, 2023, 6:56pm
#5
Is this code inside the leaderboard script?
Anyway why are you adding to ExpAdd variable,
wasn’t the variable you created for the data called EXP?
1 Like
i dont know if this issue has been fixed or not but im just gonna edit your leaderstats to make it abit shorter
local EXPVar = game.ReplicatedStorage.PlayerStats.EXP
game.Players.PlayerAdded:Connect (function(player)
player.CharacterAdded:Connect (function(character)
------- PLAYER LEADERSTATS FOLDER -------------------------------------------------------
local leaderstats = Instance.new("Folder",player)
leaderstats.Name = "leaderstats"
local Power = Instance.new("IntValue",leaderstats)
Power.Name = "Power"
Power.Value = 0
local EXP = Instance.new("IntValue",leaderstats)
EXP.Name = "EXP"
EXP.Value = EXPVar.Value
end)
end)
2 Likes
SlayterZ
(SlayterZ)
December 18, 2023, 7:09pm
#7
Putting all of the code inside of the leaderboard script seemed to work. Thank you.
1 Like
system
(system)
Closed
January 1, 2024, 7:10pm
#8
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.