Is running multiple .Heartbeat functions okay?

So as you can see in the title, I’m wondering if running multiple RunService.Heartbeat functions is ok.

No I am not spawning parts. For each player I’m using a .Heartbeat function to copy data on the player’s Profile.Data (I use ProfileService) to a separate object (IntValues, NumberValues, StringValues, etc.) and I was wondering if this would cause server lag. Here is an example of code:


and the actual folder:
image

In summary I’m just using a loop to copy data on the player’s data to some values so it wouldn’t be too much of a hassle accessing data. Again I’m wondering if this will cause any server issues/lags.

Appreciate the help.

1 Like

Why are you doing this instead of changing the folder values when you change the profile? What you’re doing wouldn’t necessarily cause lag but it is hugely inefficient.

2 Likes

I’m using ProfileService. It’s quite different than the normal DataStore. I use it to change player’s data without data issues and the folder and values is just so that I can access it properly. I don’t know yet how to access the data without doing this

I know you’re using ProfileService, but you obviously are changing the profile values from somewhere. After you change the profile values, change the folder value too.

1 Like

I guess that works, too. But do you have any idea accessing tables from another script using localscripts so that I won’t have to inefficiently use folders and values?

You could use attributes on the player, or (more complicated) receive a RemoteEvent containing the data. The first option would be efficient and easy to implement.

1 Like

I’ll check it out. Thanks for the help.

1 Like