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

Where can i learn to make this freeze players script?

Asked by 7 years ago

Im trying to make a script, where i basically use a KeyDown function and it freezes all the players around me, BUT ME, and after 5 seconds it unfreezes them, anyone know where i can find what kind of things i need to know for making such a script? like what i need to learn for it. THIS IS NOT A REQUEST BTW, JUST ASKING WHERE I CAN LEARN.

1
Anchor all the player's torso within a certain magnitude, then after 5 seconds, unanchor them crome60 43 — 7y

2 answers

Log in to vote
0
Answered by 7 years ago

crome60's comment is correct, but here's a little more detail on the steps:

  • Get the list of players (game.Players:GetPlayers())
  • For each player that isn't you who has a non-nil character and a HumanoidRootPart, compare their position to yours. If the magnitude of them (using (theirPos - yourPos).magnitude, where 'theirPos' and 'yourPos' is a Vector3) is <= 10 (or whatever distance you like), then they are close enough for the freeze effect to be applied (consider anchoring them in that case). Also, add their name to a table for later, or perhaps (if you're anchoring their HumanoidRootPart) just add that Part to the table and unanchor it later. (If you have anchored all their limbs, then you might want to add all their parts to the table.)
  • Wait 5 seconds
  • Go through the table you saved earlier and unfreeze everyone (or everything) in it. Be very careful not to access any parts that you haven't made sure still exist -- an error may leave some players frozen indefinitely. If you have stored a part in a table, you're safe to access that part. Its parent, however, might be nil.

You may need to learn about tables.

Ad
Log in to vote
0
Answered by
Master_JJ 229 Moderation Voter
7 years ago

What I would do is disable the control script under LocalPlayer.PlayerScripts. This will make it so the player is unable to move. Then I would create a block of ice around the player's torso. Later I will enable the control script, then destroy the block ice.

Answer this question