Trying to make a game and this is bugging me.
✓ ANSWER ACCEPTED
Is there a way to make players cancollide false without them falling through the ground?
2 answers
✓ Accepted answer
Add the following to a localscript and move it to StarterPlayerScripts in StarterPlayer. This should work unless you have something blocking it.
local charRegistry = {}
local function onCharacterAdded(char)
local reg = {}
local function registerChild(obj)
if obj:IsA("BasePart") then
reg[obj] = obj.Name
end
end
for _,v in pairs(char:GetChildren()) do
registerChild(v)
end
char.ChildAdded:connect(registerChild)
charRegistry[char] = reg
end
local function onPlayerAdded(player)
if player ~= game.Players.LocalPlayer then
if player.Character then
onCharacterAdded(player.Character)
end
player.CharacterAdded:connect(onCharacterAdded)
end
end
for _,v in pairs(game.Players:GetPlayers()) do
onPlayerAdded(v)
end
game.Players.PlayerAdded:connect(onPlayerAdded)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
local rs = game:GetService("RunService")
local removeList
local function update()
for char,reg in pairs(charRegistry) do
if char:IsDescendantOf(game) then
local torso = char:FindFirstChild("Torso")
if torso and torso.CanCollide then
-- Rename all the parts to BREAK.
for part in pairs(reg) do
part.Name = "BREAK"
end
-- Immediately switch back, and turn off collision.
for part,name in pairs(reg) do
part.Name = name
part.CanCollide = false
end
end
else
if not removeList then
removeList = {}
end
removeList[char] = true
end
end
if removeList then
for char in pairs(removeList) do
charRegistry[char] = nil
end
removeList = nil
end
end
rs.RenderStepped:connect(update)
1 comment
0
Wow thanks!
You can simply set the player's collidable parts to false, just make sure you don't mess with the humanoid rootpart, because that can start messing things up. It would be easier to answer if you showed the script.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
maybe set the players cancollide to false but insert a BodyPositon to make the player "float" on the ground level