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 7 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
7 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.

local part = script.Parent
local db = false

function freeze(hit)
local human = hit.Parent:FindFirstChild("Humanoid")
if human then -- checks if a human touched it
if not db then

db = true -- turns debounce on to prevent repetition of the script

human.Parent.Torso.Anchored = true -- This is one way to freeze the player. Another way is   "human.Parent.WalkSpeed = 0"

end end end -- They look nice beside each other, don't you think? 

part.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 — 7y
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 — 7y
Ad
Log in to vote
0
Answered by 7 years ago

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

local part = script.Parent
local db = false

function freeze(hit)
local human = hit.Parent:FindFirstChild("Humanoid")
if human then -- checks if a human touched it
if not db then

db = true -- turns debounce on to prevent repetition of the script

human.Parent.Torso.Anchored = true
human.Parent.Head.Anchored = true
human.Parent.Left Leg.Anchored = true
human.Parent.Left Arm.Anchored = true
human.Parent.Right Arm.Anchored = true
human.Parent.Right Leg.Anchored = true

end end end -- They look nice beside each other, don't you think? 

part.Touched:connect(freeze)--uses touch event.

To unfreeze, simply just set Anchored to false.

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

Answer this question