Favorites Data Management

Overview

The Favorites Data Management module is designed to manage and interact with players' favorite tracks within the game. It offers functionalities to check if a track is favorited by a player, set a track as a favorite, remove a track from favorites, and retrieve all favorite track IDs for a player. The module also integrates with DataStoreService to persistently store and retrieve favorite tracks for players.


Services

  • ReplicatedStorage: Used to store and access remote objects that are shared between the server and clients.

  • DataStoreService: Provides functionalities to persistently store and retrieve data on Roblox's servers.

  • Players: Manages and provides information about players in the game.


Remote Objects

  • FavoriteStatusFunction: A remote function located in ReplicatedStorage that checks if a track is favorited by a player.

  • FavoriteTrackFunction: A remote function in ReplicatedStorage that toggles the favorite status of a track for a player.

  • FavoriteIdsFunction: A remote function in ReplicatedStorage that retrieves all favorite track IDs for a player.


Functions

  • isTrackFavorited(playerId, trackId) -> boolean

    • Description: Checks if a track is marked as a favorite by a player.

    • Returns: true if the track is favorited, otherwise false.

  • setTrackAsFavorite(playerId, trackId)

    • Description: Marks a track as a favorite for a player.

  • removeFavorite(playerId, trackId)

    • Description: Removes a track from a player's favorites.

  • getFavoriteIds(playerId) -> table

    • Description: Retrieves the IDs of all tracks favorited by a player.

    • Returns: A table containing the IDs of the favorited tracks.

Last updated