When a function is activated by OnServerEvent, it will always send through the player who activated the RemoteEvent before any additional data. This means that an additional parameter needs to be added before “myFolder” (or else “myFolder” will just refer to the player object).
I think in this use case handling on the server is best, since the LocalScript of the leaving player gets deleted (I may be wrong though):
local function getTools(myFolder)
print(myFolder.Name)
end
game.Players.PlayerRemoving:Connect(function(player)
local myFolder -- path to myfolder. if you need the localPlayer then "player" is your leaving player
local myTools = {myFolder:FindFirstChildWhichIsA("StringValue")}
getTools(myTools)
end)