How can I stop players from going through walls at fast speeds?

(Let me know if this is the wrong Category)

Howdy folks! I was wondering how I can stop a player going through walls at fast speeds. In my game I have players going about 5k+ speed and the end wall cant stop them! I tried making them think, but they still go through! Right before the end there is a platform that is supposed to stop them, but the player is so fast that it doesnt detect them sometimes! Any help would be great!

1 Like

Try making the wall longer. That should stop them.

You can use collision detection to detect when a player collides with a wall

I have tried that, I made it as long as possible, and it wont work.

make it wide, too. that will fix it.

-- Insert this script into the wall part you want to detect collisions with

local wall = script.Parent
local pushForce = 100 -- Adjust this value to change how strong the force is

function onTouched(otherPart)
    local humanoid = otherPart.Parent:FindFirstChildOfClass("Humanoid")
    if humanoid then
        local pushDirection = wall.CFrame.LookVector * -1 
        humanoid:ChangeState(Enum.HumanoidStateType.Physics)
        humanoid:ApplyImpulse(pushDirection * pushForce)     
    end
end

wall.Touched:Connect(onTouched)

The player is still going to fast for it to detect in time.

1 Like

How fast is your player going? Because if they’re going too fast then it will clip through the wall because it is too fast to render.

To solve this, you have to raycast to the player’s last position per frame. If there is an object in between the player then make it correct it self.

This problem is called “The fast bullet problem”

Make the wall 2048x2048x2048 in size.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.