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!
-- 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)