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

How can one player walk through other players?

Asked by 8 years ago

I knwo some games have this but turning off can collide they would just fall, how would I do it where they can only walk through other players.

3 answers

Log in to vote
0
Answered by 8 years ago

NOTE: This may only work using uncollided parts

-- Made with <3 by markisntcrazy
local body = {"Left Arm", "Right Arm", "Torso", "Right Leg", "Left Leg", "Head"}
for i = 1, #arms do
Workspace.Player[body[i]].CanCollide = false
end

Ad
Log in to vote
0
Answered by 8 years ago

sorry for my fellow helpers utter incompetence. I for one realize there is no other place besides the wiki and youtube you can go to, and even then you would much rather hear it from another scripter. Not to mention there is no such thing as a website that does requests for scripting. SO that being said, lets discuss this. so I see your problem, I don't know a proper solution, but you can start by making a script that adds a BodyPosition to the character with very large maximum force values when a player collides with another player, this will make your player levitate, then turn the can collide values off for each of the characters body parts, In theory, the players will move through each other without colliding. Then be sure to remove the BodyPosition and set all body parts back to can collide = true. In theory this will work. the only concern I have is the characters may just stay in one spot and levitate instead, but its still worth a shot. Good Luck! The admins will probably remove your question before I have time to reply to any questions, so just message me on roblox if you have any problems.

Log in to vote
0
Answered by 5 years ago

Hello, this script should work. (No, it isn't mine. I found it while scouring the internet.) Just put it in a script in ServerScriptService

local PhysicsService = game:GetService("PhysicsService") local Players = game:GetService("Players")

local playerCollisionGroupName = "Players" PhysicsService:CreateCollisionGroup(playerCollisionGroupName) PhysicsService:CollisionGroupSetCollidable(playerCollisionGroupName, playerCollisionGroupName, false)

local previousCollisionGroups = {}

local function setCollisionGroup(object) if object:IsA("BasePart") then previousCollisionGroups[object] = object.CollisionGroupId PhysicsService:SetPartCollisionGroup(object, playerCollisionGroupName) end end

local function setCollisionGroupRecursive(object) setCollisionGroup(object)

for _, child in ipairs(object:GetChildren()) do setCollisionGroupRecursive(child) end end

local function resetCollisionGroup(object) local previousCollisionGroupId = previousCollisionGroups[object] if not previousCollisionGroupId then return end

local previousCollisionGroupName = PhysicsService:GetCollisionGroupName(previousCollisionGroupId) if not previousCollisionGroupName then return end

PhysicsService:SetPartCollisionGroup(object, previousCollisionGroupName) previousCollisionGroups[object] = nil end

local function onCharacterAdded(character) setCollisionGroupRecursive(character)

character.DescendantAdded:Connect(setCollisionGroup) character.DescendantRemoving:Connect(resetCollisionGroup) end

local function onPlayerAdded(player) player.CharacterAdded:Connect(onCharacterAdded) end

Players.PlayerAdded:Connect(onPlayerAdded)

0
This Post Is 3 Years Old. Also, Use CodeBlock While Typing Scripts User#34743 0 — 4y

Answer this question