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

How to make other players non-collidable?

Asked by 10 years ago

So I've been trying to think of a few ways this might work and I've come up with none. I've searched around a bit and came across this forum post and it still shows that what I thought might work would not.

I thought perhaps you could use local parts and perhaps do some welding but as the forum post says the OP tried and failed to get that to work. So I am coming here to ask what other solutions could there be?

Just to make sure you understand what I am asking: How would I make it so that you cannot collide with other players?

Normally I would provide some code to show what I've tried but I don't even know where to begin with this one...

0
Good question. I'm interested for the answer myself. Spongocardo 1991 — 10y

2 answers

Log in to vote
1
Answered by
RoboFrog 400 Moderation Voter
10 years ago

Neither approach I have is probably efficient, but I could see both being useful in certain game types.

For the first, you would need to create two separate maps -- one which is invisible, and X amount of studs higher than the visible one. Players would then spawn on the invisible map, and upon joining, their character would become invisible, and every body part would then be "Cloned" to the appropriate position (being the real body part's current position - the Y difference of the invisible map to the visible) on the visible map.

These body parts (on the visible map) would be visible of course, and whenever your character moves, each body part below would update accordingly. The rectify the camera issue, it would be quite easy to move the player's camera to the fake head whenever their player is cloned through simple use of local scripts in StarterGui.

However, with this, you might experience more lag than necessary, as well as a bit of lag with the movement of body parts. Physical tools and touched scripts would also require a lot more coding to get working. Regardless of the cons, I suppose this is one way.



The second method seems a bit more useful and simple. With this, each player would be made non-collide upon joining. You would then need to place a script into every block on the map (not difficult to do, of course). This script would basically move the player out of itself by using one of the body gyro/thrust/velocity things (I can never remember which one is appropriate until I test), or even CFrame. You could test if the player is inside of it by making a calculation that checks if any part of the player (excluding the arm) is within it's X coordinate * it's X size, if you understand what I'm generally saying.



These are all in theory though, and I can't verify either one works. I'm sure there's a better way to do it somewhere out there, but one of these (likely the second) would be where I'd personally start.

Good luck!

Ad
Log in to vote
0
Answered by
RubenKan 3615 Moderation Voter Administrator Community Moderator
8 years ago

I've been using this for a while, it works perfect. Put in localscript inside startgui/starterpack

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

Answer this question