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

CanCollide not working on my character?

Asked by 3 years ago

Hello! I made a script to make me go through parts in the workspace, to do so I used a RemoteEvent that makes each part of my character CanCollide = false and it actually works, but it still won't let me go through parts. Here is my script. :) Any help?

local db = false
local Character = script.Parent.Parent.Parent


game.ReplicatedStorage.RemoteEvents.PermeationSkill.Permeate.OnServerEvent:Connect(function(plr)
    plr.Character.Humanoid.MaxHealth = 15
    plr.Character.Humanoid.Health = 15

    for i,v in pairs(Character:GetDescendants()) do
        if v:IsA("BasePart") then
            v.CanCollide = false
            v.Transparency = 0.65
            Character.Humanoid.WalkSpeed = 7
        end
    end
end)

0
try setting Platfrom stand to true in the humanoid..? ZIRFAL3 17 — 3y
0
wait- ZIRFAL3 17 — 3y
0
do you want to go through objects? TheSpecialNone 29 — 3y
0
Yes. Fixer1987 95 — 3y

3 answers

Log in to vote
0
Answered by 3 years ago
local PS = game:GetService("PhysicsService")
PS:CreateCollisionGroup("Player")
PS:CollisionGroupSetCollidable("Player","Player",false)

game.Players.PlayerAdded:Connect(function(Player)
    Player.CharacterAdded:Connect(function(Character)
        Character:WaitForChild("HumanoidRootPart")
        Character:WaitForChild("Head")
        Character:WaitForChild("Humanoid")
        for i,v in pairs(Character:GetChildren()) do
            if v:IsA("BasePart") then
                PS:SetPartCollisionGroup(v,"Player")
            end
        end
    end)
end)

0
Doesn't work. Fixer1987 95 — 3y
Ad
Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

The HumanoidRootPart Is Can Go Through, But The Other Parts Cant.

You Need To Change The Cancollide For Every Part.

If You Want It To Do It By Script,

for _, child in pairs(script.Parent:GetChildren()) do
        if child:IsA("Part") then
            child.Cancollide = false
        end

        -- You Can Also Put An Elseif instead.
        if child:IsA("BasePart") then
            child.Cancollide = false
        end
    end

Or Manually,

Select Each Body Parts And Change The Cancollide.

0
How do I do that? Fixer1987 95 — 3y
0
One Sec. Brioche_Noodle 45 — 3y
0
Edited. Brioche_Noodle 45 — 3y
0
Still won't work. Fixer1987 95 — 3y
0
Actually, Try Use Collision Group ID, Try 3 I Think. Brioche_Noodle 45 — 3y
Log in to vote
0
Answered by 3 years ago

I just fixed this by using a Touched event and make the parts I touch CanCollide = false.

Answer this question