If i wanted players to have stats; exp, level, money and stored the stats in ReplicatedStorage as Values, and had a hud to display those stats, how would I go about updating the hud with those stats constantly, so that if level changes it instantly changes on the hud? I'm trying to use this with filtering enabled.
Here is a simple script that I made to display the player's stats on a text label.
while true do script.Parent.Text = game.Players.LocalPlayer.leaderstats.Money.Value wait(1) end --change "money" to your leaderstat
You could make use of the Changed event of NumberValues.
The Changed event fires when the Value property of a NumberValue changes.
expVal = game.ReplicatedStorage.Exp --the NumberValue object for exp expVal.Changed:connect(function() script.Parent.Text = expVal.Value.." EXP" end) --this script goes into a TextLabel that displays exp stat
A local script should have no problems accessing ReplicatedStorage, but it may be beneficial to use :WaitForChild()
in case the contents of ReplicatedStorage haven't yet been replicated to the client.
As for the GUI, a local script can change it without requiring server interaction.