Hi,
I’m currently trying to make a level and EXP indicator for a game with GUIs. ProfileService doesn’t work on local scripts, and using a regular Script under the GUIs doesn’t work either, returning “Module code did not return exactly 1 value.” Correct me if I am wrong, but I think I need to use a RemoteEvent to communicate this correctly, but I am really not sure where to being, and most tutorials don’t seem to help with this exact situation.
Here is the code that I used for the GUI script.
local DataManager = require(game.ReplicatedStorage.DataManager)
local txt = script.Parent
local exptxt = script.Parent.Parent.Parent.EXPbar
local function onPlayerAdded(player)
if player then
local data = DataManager:Get(player)
if data then
local leveltext = tostring(data.level)
local experience = tostring(data.exp)
local maxexp = (((data.level)*100)+100)
txt.Text = leveltext
exptxt.Text = experience.." EXP / "..maxexp .." EXP"
else
txt.Text = "No level data found."
exptxt.Text = "Please contact our socials."
end
end
end
game.Players.PlayerAdded(onPlayerAdded)
Any guidance on how to use RemoteEvents or another solution would be greatly appreciated. Thank you!