generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: how to let characters pass through each other?

Previous Thread :: Next Thread 
Deanh22a is not online. 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
Reflectioned is not online. Reflectioned
Joined: 18 Feb 2014
Total Posts: 2736
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 is not online. RogueMage
Joined: 28 Jan 2012
Total Posts: 1235
15 Feb 2017 01:16 AM
please dont use repeat loop.png

Report Abuse
Reflectioned is not online. Reflectioned
Joined: 18 Feb 2014
Total Posts: 2736
15 Feb 2017 01:17 AM
k l0l
Report Abuse
Deanh22a is not online. 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
Lua_Basics is not online. Lua_Basics
Joined: 04 Jun 2012
Total Posts: 9977
15 Feb 2017 02:02 AM
^ That'd break a lot of things though.
Report Abuse
Deanh22a is not online. 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 is not online. 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 is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image