im trying to make a noclip script its working but when the character leaves the part how do I make the part can collided to true
game.workspace.Pleasedonatefreeloot.Head.Touched:connect(function(hit) hit.CanCollide = false for i,v in pairs(hit:GetDescendants()) do v.CanCollie = false print(hit.Name.."Nocliped") end end)
You can do it by using TouchEnded:
local function onTouched(hit) hit.CanCollide = false for i,v in pairs(hit:GetDescendants()) do v.CanCollide = false print(v.Name.."Nocliped") end end local function onTouchEnded(hit) hit.CanCollide = true for i,v in pairs(hit:GetDescendants()) do v.CanCollide = true print(v.Name.."Nocliped") end end workspace.Pleasedonatefreeloot.Head.Touched:Connect(OnTouched) workspace.Pleasedonatefreeloot.Head.TouchEnded:Connect(OnTouchEnded)