This script to freeze the character isn't working. Help?
local player = game.Players.LocalPlayer
local torso = player:WaitForChild('UpperTorso')
torso.Anchored = true
This script to freeze the character isn't working. Help?
local player = game.Players.LocalPlayer
local torso = player:WaitForChild('UpperTorso')
torso.Anchored = true
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
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.
1 comment
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