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

How do I make a script that will freeze a player?

Asked by 8 years ago

I'm currently making a plane, so I don't want to use Admin all the time for freeze myself in the plane. How do I make a script that freezes the person? This must prevent the whole plane from moving Thx for the help!

2 answers

Log in to vote
0
Answered by
Peeshavee 226 Moderation Voter
8 years ago

First of all, this is a request. You should try by yourself first. But, I wanna help out anyway. Now, you're not being very descriptive. So I'll assume, that you want to freeze the player when, let's say he touches a part.

01local part = script.Parent
02local db = false
03 
04function freeze(hit)
05local human = hit.Parent:FindFirstChild("Humanoid")
06if human then -- checks if a human touched it
07if not db then
08 
09db = true -- turns debounce on to prevent repetition of the script
10 
11human.Parent.Torso.Anchored = true -- This is one way to freeze the player. Another way is   "human.Parent.WalkSpeed = 0"
12 
13end end end -- They look nice beside each other, don't you think?
14 
15part.Touched:connect(freeze)--uses touch event.

This script is put in the part you want to be touched. Hope this helped! If it did, please don't forget to accept my answer. If you have any questions, feel free to comment!

0
Wouldn't you want to anchor all parts in the player, not just the Torso? OldPalHappy 1477 — 8y
0
No. With the new updates, if you anchor any body part the person will freeze, not moving or being affected by gravity. SH_Helper 61 — 8y
Ad
Log in to vote
0
Answered by 8 years ago

Fix to Peeshavee's script, his only freezes the torso.

01local part = script.Parent
02local db = false
03 
04function freeze(hit)
05local human = hit.Parent:FindFirstChild("Humanoid")
06if human then -- checks if a human touched it
07if not db then
08 
09db = true -- turns debounce on to prevent repetition of the script
10 
11human.Parent.Torso.Anchored = true
12human.Parent.Head.Anchored = true
13human.Parent.Left Leg.Anchored = true
14human.Parent.Left Arm.Anchored = true
15human.Parent.Right Arm.Anchored = true
16human.Parent.Right Leg.Anchored = true
17 
18end end end -- They look nice beside each other, don't you think?
19 
20part.Touched:connect(freeze)--uses touch event.

To unfreeze, simply just set Anchored to false.

0
Anchoring Torso, anchors everything... Peeshavee 226 — 8y

Answer this question