Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to script my Parts to be not CanCollideable on touch?

Asked by 2 years ago
Edited 2 years ago

for key, value in pairs(game.Workspace.Anxiety:GetDescendants()) do if value:IsA("BasePart") and value.Name == "Base" then value.Touched:Connect(function(testDictionary) testDictionary.CanCollide = false end) end end for key, value in pairs(game.Workspace.Anxiety.Modell:GetDescendants()) do if value:IsA("BasePart") and value.Name == "Base" then value.Touched:Connect(function(testDictionary) testDictionary.CanCollide = false end) end end

1 answer

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

Instead, use "Code Blocks" like this one:

print("Use Code Blocks!")

And you can simply just use:

script.Parent.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild("Humanoid") then
        script.Parent.CanCollide = false
    end
end)
Ad

Answer this question