I am not entirely sure how to ask this question, but I want to use a variable when declaring a child's location in a hierarchy. Here is the code in ServerScriptService:
--omitted code
game.Players.userName.leaderstats.Robux.Value += receiptInfo.CurrencySpent
-- Omitted code
userName is a global variable and not a child in a hierarchy. I want to use it to declare what child I am looking for.
In StarterPlayer.StarterPlayerScripts I have a local script which contains the global variable:
--omitted Code
local player = game.Players.LocalPlayer
--omitted code
userName = game.Players.LocalPlayer.Name