I want to know how to detect a players level increasing so that I can update UI etc with the new level.
Here is how I hold the players level (via table).
pDM.MainInventory={
['Level'] = 0;
}
(obviously not the full table is listed but you get the point)
Assuming that you level up the player in a server script, you can use a remote event to communicate that a player has leveled up. They are typically put in replicated storage when communicating from server to client and vice versa
For example:
-- server script
local event = game.ReplicatedStorage.RemoteEvent
LevelPlayer(plr) -- arbitrary function that would level up the player
event:FireClient(plr)
-- ui script
local event = game.ReplicatedStorage.RemoteEvent
-- emits an event called 'OnClientEvent' when firing to the client
event.OnClientEvent:Connect(function()
-- code to update ui accordingly
end)