How to make the character untouchable?

  1. What do you want to achieve? Make my character untouchable.

  2. What is the issue? Im trying to make my character untouchable using CanTouch = false but its not working.

  3. What solutions have you tried so far? I tried to set the HumanoidRootPart CanTouch = false but it din’t working.

robloxapp-20221006-2042580.wmv (677.3 KB)

script:

local event = game.ReplicatedStorage:WaitForChild("JoinEvent")

event.OnServerEvent:Connect(function(player)
local char = player.Character

 char["HumanoidRootPart"].CanTouch = false
end)

Why this isn’t working?

You’re going to need a little more than that. A character consists of way more than a humanoidrootpart, such as legs, arms, a head, and way more. Implement what you want by looping through the character and making every basepart untouchable:

for _, part in ipairs(char:GetDescendants()) do
    if part:IsA("BasePart") then
        part.CanTouch = false
    end
end