Deanh22a
|
  |
| Joined: 02 Oct 2016 |
| Total Posts: 49 |
|
|
| 15 Feb 2017 01:06 AM |
| I'm trying to let characters pass through each other. I tried setting all the character's parts.CanCollide to false. But the game constantly resets the head, upper torso, and lower torso back to true. I'm not sure if that's the right way to be doing it anyway because they might fall through the floor. Any idea how to do it? |
|
|
| Report Abuse |
|
|
|
| 15 Feb 2017 01:15 AM |
repeat wait() for i,v in pairs(game.Players:children()) do local chr=v.Character if v~=game.Players.LocalPlayer and chr and chr:findFirstChild('Torso') and chr.Torso.CanCollide then for a,b in next,chr:children() do if b:IsA('BasePart') then b.Name=b.Name..'Fake' end end for a,b in next,chr:children() do if b:IsA('BasePart') then b.Name=b.Name:gsub('Fake','') b.CanCollide=false end end end end until nil |
|
|
| Report Abuse |
|
|
RogueMage
|
  |
| Joined: 28 Jan 2012 |
| Total Posts: 1235 |
|
|
| 15 Feb 2017 01:16 AM |
please dont use repeat loop.png
|
|
|
| Report Abuse |
|
|
| |
|
Deanh22a
|
  |
| Joined: 02 Oct 2016 |
| Total Posts: 49 |
|
|
| 15 Feb 2017 01:53 AM |
So you're saying change the names of the torso and head so the game won't set cancollide back to true?
|
|
|
| Report Abuse |
|
|
|
| 15 Feb 2017 02:02 AM |
| ^ That'd break a lot of things though. |
|
|
| Report Abuse |
|
|
Deanh22a
|
  |
| Joined: 02 Oct 2016 |
| Total Posts: 49 |
|
|
| 15 Feb 2017 03:57 AM |
| So, my only idea so far is to change the names of the parts and turn off collision while the character is passing through, and then put it back like it was afterwards. The problem with that is, all the pieces fall apart when I do that, so I have to anchor all the pieces of one of the characters in place while they're passing through. then when they've passed through, unanchor everything and set the names and collision back, and I might have to restore the connections of the pieces so it doesn't fall apart. I think I saw a function that restores the connections somewhere but I forgot what it was. |
|
|
| Report Abuse |
|
|
Deanh22a
|
  |
| Joined: 02 Oct 2016 |
| Total Posts: 49 |
|
|
| 15 Feb 2017 02:32 PM |
here's how I did it:
function setCharacterCollideable(theChar, trueOrFalse)
local part
if trueOrFalse == false then for _, part in pairs(theChar:GetChildren()) do if part:IsA("BasePart") or part:IsA("Part") or part:IsA("MeshPart")then part.Anchored = true part.Name = part.Name.."9999" part.CanCollide = false end -- if it's a part end--for each child end -- if false
if trueOrFalse == true then for _, part in pairs(theChar:GetChildren()) do if part:IsA("BasePart") or part:IsA("Part") or part:IsA("MeshPart")then part.Name = part.Name:gsub('9999','') part.CanCollide = true theChar.Humanoid.Health = 100 --or you die end --if it's a part end -- for each child wait()--or you di### for _,##art in pairs(theChar:GetChildren()) do if part:IsA("BasePart") or part:IsA("Part") or part:IsA("MeshPart")then part.Anchored = false end--if it's a part end--for each child
end-- if true end --setCharacterCollideable()
the only problem is that the other character can't move while you're passing through them. Is there a better way? |
|
|
| Report Abuse |
|
|
Deanh22a
|
  |
| Joined: 02 Oct 2016 |
| Total Posts: 49 |
|
|
| 15 Feb 2017 02:35 PM |
^^ in that last section it changed some of the code into ## for some reason. it was supposed to be
for _, part in pairs(theChar:GetChildren()) do if part:IsA("BasePart") or part:IsA("Part") or part:IsA("MeshPart")then part.Anchored = false end--if it's a part end--for each child |
|
|
| Report Abuse |
|
|
Deanh22a
|
  |
| Joined: 02 Oct 2016 |
| Total Posts: 49 |
|
|
| 15 Feb 2017 04:45 PM |
| also, the shirt and pants disappear while the character is pass-through :/ |
|
|
| Report Abuse |
|
|