Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How could I freeze time in a game?

Asked by 3 years ago

This regarding a post from someone that posted this 2 years ago I would like to know if someone know how to make a time stop for roblox like in the jojo game?

0
This completely depends on context, you will need to come up with something on your own. Benbebop 1049 — 3y

1 answer

Log in to vote
1
Answered by 3 years ago
Edited 3 years ago

The following is a loose outline and base idea to get your logic on the right path to begin working on this.

To start, you wouldn't actually be "stopping/freezing time" nor would you want to. You wouldn't want to actually stop the processing of scripts, server, etc, right? Right.

To accomplish this, we would want to freeze all local indications to the client of "time" progressing.

What do I mean by "indications of time progressing"?

Well, while this list isn't all inclusive and depends on your game, it could include halting things such as:

  • Perceived movement of surrounding players
  • Time of day/weather (if your game includes this)
  • Anything that moves other than yourself.
  • Sounds

Keep in mind the goal: To give the perceived effect, to the client, that time has stopped, while not actually halting the game itself.

First you should decide:

[1] Do I actually want other players to be affected (stopped) by this perceived "freeze of time"?

OR

[2] Do I only want to affect the perception of time for one player while everyone else remains unaffected?

To accomplish path [1], you would want the server to be in charge of halting any indications to players that could be perceived as time progression. This could include anything from simply setting all players' WalkSpeed to 0 and anchoring them, anchoring moving parts, disabling chat momentarily, etc. Keep in mind, this could result in very frustrating game mechanics to all the players who are constantly being halted and frozen in time by another player.

To accomplish path [2], you would want the client to be in charge of halting any indications to themselves that could be perceived as time progression. This would give the affect to the player that although "time has stopped" they are still moving through "frozen time". Since there are other players that are constantly being replicated/updated to the client by the server, and since a client is not allowed to alter properties of other clients without going through the server (would have to use a RemoteEvent or RemoteFunction for the client to affect other clients through the server. See RemoteEvents) - you could do something along the lines of the following:

Have a LocalScript on the client make a clone of all other players in the game, maintaining their current position, orientation, CFrame, etc, and anchor it. You would then want the client to make all the real players' characters invisible. This allows other players to still remain unaffected while the affected client perceives that all other players have "frozen" in place. The affected client would now only see the "frozen" clones and not see the actual players. On the flip side, if you want all other players to not perceive or be able to affect the affected player who is "frozen in time" anymore, you would want the server to make the affected client invisible to all other players as well. Obviously reversing all these things, deleting the clone, etc, when time resumes to normal.

[Remember] When a client alters server side objects or tries to affect anything on the server via a LocalScript without using a RemoteEvent/Function, that behavior will ONLY be recognizable by the client who caused the change and the behavior will not replicate to other clients through the server. See Roblox Client-Server Model

The exact method of accomplishing this goal is contingent heavily upon the game, its mechanics, how the game is suppose to be played, player to player interactions, etc. This answer's intention is not to give you the 'secret formula' to time travel, but to hopefully aid in opening your mind to the outside-the-box thinking that is frequently required to create a desired effect for a player in a game.

If you have further questions, please leave a comment and I will update and clarify in my answer or respond directly to the comment.

Ad

Answer this question