Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I freeze the character in place?

This script to freeze the character isn't working. Help?

local player = game.Players.LocalPlayer
local torso = player:WaitForChild('UpperTorso')

torso.Anchored = true

2 answers

UpperTorso is within the Character, not the Player.

I've created a variable character. The or statement is there in case the script loads before the character does, which would result in an error.

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local torso = character:WaitForChild("UpperTorso")
wait(2)
torso.Anchored = true

1 comment

0

I just want to comment that you cant use LocalPlayer to get the Character Torso. the Character is in your Workspace. While your Player is in Players. When you call LocalPlayer. Thats asking for your Player in Players. Not your Character. The Torso is a child of your Character

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local head = character:FindFirstChild("Head") or character:WaitForChild("Head")
head.Anchored = true

or

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:FindFirstChild("Humanoid") or character:WaitForChild("Humanoid")
local canjump = false

humanoid.WalkSpeed = 0

humanoid:GetPropertyChangedSignal("Jump"):Connect(function()
	if canjump == false then
	humanoid.Jump = false
	end
end)

or

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:FindFirstChild("Humanoid") or character:WaitForChild("Humanoid")

if humanoid.RigType == Enum.HumanoidRigType.R15 then
local uppertorso = character:FindFirstChild("UpperTorso") or character:WaitForChild("UpperTorso")
uppertorso.Anchored = true
elseif humanoid.RigType == Enum.HumanoidRigType.R6 then
local torso = character:FindFirstChild("Torso") or character:WaitForChild("Torso")
torso.Anchored = true
end

This discussion is preserved as it was. New answers, comments, and votes are closed.