You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I want to disable collisions between players when they are climbing a ladder.
What is the issue? Include screenshots / videos if possible!
I disabled collisions, so I’m able to walk through a person on the ground without a problem. When Two players are on a ladder though, and they come in contact with each other, it bugs and it’s as if they’re colliding, even though I disabled it.
What solutions have you tried so far? Did you look for solutions on the Creator Hub?
There has been solutions for disabling collisions between players, but not one specifically when two players are on a ladder.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
Here’s my collision server script
local Players = game:GetService("Players")
local PhysicsService = game:GetService("PhysicsService")
local GroupName = "Players"
PhysicsService:RegisterCollisionGroup(GroupName)
PhysicsService:CollisionGroupSetCollidable(GroupName, GroupName, false)
local function ChangeGroup(part)
if part:IsA("BasePart") then
part.CollisionGroup = GroupName
end
end
local function HandleCharacterAdded(character)
for _, part in ipairs(character:GetDescendants()) do
ChangeGroup(part)
end
end
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
HandleCharacterAdded(character)
character.ChildAdded:Connect(function(object)
ChangeGroup(object)
end)
end)
end)
In your Studio Settings try going to the physics tab and clicking the “Are Contact Points Shown” tool. It puts a red sphere where items are contacting. It’s my go to tool when troubleshooting physical contacts when building vehicles (I leave it on all the time).
I’m just wondering if it’s a physical contact, or whether the climbing animation is being stopped because the humanoids aren’t sensing a ladder, they are sensing the other player’s Parts.
When they get stuck, look at the HumanoidStateType to see if it’s still in the Climbing state.
I’m not too sure how to fix it, but these suggestions may point you in a better direction and can give others trying to help a bit more information.
I found a solution. I totally forgot to include the system in my game that checks if the person is even on the ladder. I used ray cast parameters so I was using that to see if the person was touching the truss part, and if something interfered or went between the player and the ladder, that would trigger the falling sequence. Thank you for your time and expertise! The script shows the function that checked to see if the person was on the ladder, I have since updated the function to ignore other players.
local function isOnLadder()
-- If physically touching ladder, it's guaranteed
if touchingLadder then
return true
end
-- Backup raycast check for cases where speed might skip touching
local rayParams = RaycastParams.new()
rayParams.FilterDescendantsInstances = {char}
rayParams.FilterType = Enum.RaycastFilterType.Exclude
local directions = {
Vector3.new(0, 0, 2), -- Forward
Vector3.new(0, 0, -2), -- Backward
Vector3.new(2, 0, 0), -- Right
Vector3.new(-2, 0, 0) -- Left
}
for _, dir in ipairs(directions) do
local result = workspace:Raycast(HRP.Position, HRP.CFrame:VectorToWorldSpace(dir), rayParams)
if result and result.Instance:IsA("TrussPart") and result.Instance:IsDescendantOf(Ladder) then
return true
end
end
return false
end
--ServerScript in ServerScriptService
local physicsService = game:GetService("PhysicsService")
physicsService:CreateCollisionGroup("Players")
physicsService:CollisionGroupSetCollidable("Players", "Players", false)
local function setGroup(character)
for _, part in pairs(character:GetDescendants()) do
if part:IsA("BasePart") then
physicsService:SetPartCollisionGroup(part, "Players")
end
end
end
for _, player in pairs(game.Players:GetPlayers()) do
if player.Character then
setGroup(player.Character)
end
player.CharacterAdded:Connect(setGroup)
end
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(setGroup)
end)
Players can’t collide with other players at all like this. Yes, I changed my mind.. May as well just go server script.
i believe this happens because you used .ChildAdded instead of .DescendantAdded, this worked for me:
--// Services
local Players = game:GetService("Players")
--// Storage
local collisionGroup = "Characters"
local function setCollisionGroup(instances: ({BasePart} | BasePart))
if not instances then
return
end
if typeof(instances) == "table" then
for _, v in ipairs(instances) do
setCollisionGroup(v)
end
return
end
if not instances:IsA("BasePart") then
return
end
instances.CollisionGroup = collisionGroup
end
local function onCharacterAdded(character: Model)
if not character then
return
end
setCollisionGroup(character:GetDescendants())
character.DescendantAdded:Connect(setCollisionGroup)
end
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(onCharacterAdded)
end)
as for your isOnLadder method, you could have just checked the player’s humanoidstate
You’re on a ladder, this isn’t going to work. That was a modified car to car script.
Roblox use Humanoid physics differently. The Humanoid moves via Humanoid:Move, and when climbing ladders, Roblox treats the player as being “on a part” (the ladder), so collisions can still push players apart or block them.
I’m not even sure how to do this now..
Best guess without testing.. step by step what will work here.
ServerScript
--ServerScript in ServerScriptService
local PhysicsService = game:GetService("PhysicsService")
local Players = game:GetService("Players")
PhysicsService:CreateCollisionGroup("Players")
PhysicsService:CollisionGroupSetCollidable("Players", "Players", false)
PhysicsService:CollisionGroupSetCollidable("Players", "Default", true)
local function setGroup(character)
for _, part in pairs(character:GetDescendants()) do
if part:IsA("BasePart") then
PhysicsService:SetPartCollisionGroup(part, "Players")
end
end
end
for _, player in pairs(Players:GetPlayers()) do
if player.Character then
setGroup(player.Character)
end
player.CharacterAdded:Connect(setGroup)
end
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(setGroup)
end)
local LadderTracking = {} -- [player] = isClimbing
local function setupLadder(ladder)
if ladder:IsA("BasePart") and ladder.Name == "Ladder" then
ladder.Touched:Connect(function(part)
local character = part.Parent
local player = Players:GetPlayerFromCharacter(character)
if player then
LadderTracking[player] = true
end
end)
ladder.TouchEnded:Connect(function(part)
local character = part.Parent
local player = Players:GetPlayerFromCharacter(character)
if player then
LadderTracking[player] = false
end
end)
end
end
for _, ladder in pairs(workspace:GetDescendants()) do
setupLadder(ladder)
end
workspace.DescendantAdded:Connect(setupLadder)
Should do it or you will not be able to climb the ladder.