I have a GUI that shows you how much Units you have (Units being the ingame currency).
The GUI that shows your units updates only when the value changes, and I was wondering if when a player join if it is possible to update there units based on there units value.
But no matter what I did it didnt error, nor did it work.
Units are stored under Replicated Storage.DataFile[player.Name].Units
Heres the GUI script, its located under a surfaceGui in starterGui
local ReplicatedStorage = game:GetService("ReplicatedStorage") local player = game.Players.LocalPlayer local dataFile = ReplicatedStorage:WaitForChild("DataFile") local playerName = dataFile[player.Name] local units = playerName:WaitForChild("Units") units.Changed:connect(function(newValue) script.Parent.Text = tostring(newValue) .. " UNITS" end)
Thank you for your time, again the script updates but only when the value changes so when players first join it says they have 0 Units because the value hasnt changed yet. So is there anyway it can get the units when a player join and update them there also?